mediawiki-extensions-Visual.../modules/ve/dm/nodes/ve.dm.MWReferenceListNode.js
Catrope 85d67ce44f Do proper HTML preservation in ve.dm.MWReferenceListNode
Store the HTML as a domElements array like everywhere else, rather than
as a string. Also disable HTML attribute preservation because there's
no point doing that when we're already preserving all of the HTML.

Also fixed a misnamed attribute (<li li="foo"> --> <li id="foo">) in
the test case.

Change-Id: I36bf8bade8118e07a75eb6f3a2427a00ef4915d7
2013-05-07 21:41:29 -07:00

51 lines
1.3 KiB
JavaScript

/*!
* VisualEditor DataModel MWReferenceListNode class.
*
* @copyright 2011-2013 VisualEditor Team and others; see AUTHORS.txt
* @license The MIT License (MIT); see LICENSE.txt
*/
/**
* DataModel MediaWiki reference list node.
*
* @class
* @extends ve.dm.LeafNode
* @constructor
* @param {number} [length] Length of content data in document; ignored and overridden to 0
* @param {Object} [element] Reference to element in linear model
*/
ve.dm.MWReferenceListNode = function VeDmMWReferenceListNode( length, element ) {
// Parent constructor
ve.dm.LeafNode.call( this, 0, element );
};
/* Inheritance */
ve.inheritClass( ve.dm.MWReferenceListNode, ve.dm.LeafNode );
/* Static members */
ve.dm.MWReferenceListNode.static.name = 'MWreferenceList';
ve.dm.MWReferenceListNode.static.matchTagNames = null;
ve.dm.MWReferenceListNode.static.matchRdfaTypes = [ 'mw:Object/References' ];
ve.dm.MWReferenceListNode.static.storeHtmlAttributes = false;
ve.dm.MWReferenceListNode.static.toDataElement = function ( domElements ) {
return {
'type': this.name,
'attributes': {
'domElements': ve.copyArray( domElements )
}
};
};
ve.dm.MWReferenceListNode.static.toDomElements = function ( dataElement ) {
return dataElement.attributes.domElements;
};
/* Registration */
ve.dm.modelRegistry.register( ve.dm.MWReferenceListNode );