mediawiki-extensions-Visual.../modules/ve/dm/nodes/ve.dm.MWMetaNode.js
Ed Sanders edcaaf9edc Use static.name once for ce and dm nodes
Add a static.name property to ce nodes and make sure both ce
and dm nodes always use the static.name property in constructors
and registration calls.

The result of this is that any given node type should now only
appear once in the code as a string.

Bug: 45701
Change-Id: Ibf31de16ab28ad58209c1443cd74f93dda278998
2013-03-07 17:19:39 -08:00

40 lines
1.1 KiB
JavaScript

/*!
* VisualEditor DataModel MWMetaNode class.
*
* @copyright 2011-2013 VisualEditor Team and others; see AUTHORS.txt
* @license The MIT License (MIT); see LICENSE.txt
*/
/**
* DataModel MW-specific meta node.
*
* @class
* @abstract
* @extends ve.dm.MetaNode
* @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.MWMetaNode = function VeDmMWMetaNode( length, element ) {
// Parent constructor
ve.dm.LeafNode.call( this, 0, element );
};
/* Inheritance */
ve.inheritClass( ve.dm.MWMetaNode, ve.dm.MetaNode );
/* Static Properties */
ve.dm.MWMetaNode.static.name = 'MWmeta';
ve.dm.MWMetaNode.static.matchRdfaTypes = [ /^mw:/ ];
// toDataElement inherited from MetaNode, will return regular metaBlock/metaInline elements but
// that's fine. This class is only here so that <meta>/<link> tags with an mw: type are correctly
// mapped to MetaNode and aren't alienated.
/* Registration */
ve.dm.modelRegistry.register( ve.dm.MWMetaNode );