mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-25 14:56:20 +00:00
fd49e8df32
In this commit several methods (child node add/remove and parent/root modification) were also moved to ve.dm.BranchNode ve.dm.Node respectively. ve.Node and ve.BranchNode are immutable. ve.dm.Node and ve.dm.BranchNode are mutable. Other subclasses of ve.Node and ve.BranchNode should implement functionality to mimic changes made to a data model. Change-Id: Ia9ff78764f8f50f99fc8f9f9593657c0a0bf287e
25 lines
642 B
JavaScript
25 lines
642 B
JavaScript
/**
|
|
* Data model node that can have leaf children.
|
|
*
|
|
* @class
|
|
* @abstract
|
|
* @constructor
|
|
* @extends {ve.TwigNode}
|
|
* @extends {ve.dm.BranchNode}
|
|
* @param {String} type Symbolic name of node type
|
|
* @param {ve.dm.Node[]} [children] Child nodes to attach
|
|
* @param {Object} [attributes] Reference to map of attribute key/value pairs
|
|
*/
|
|
ve.dm.TwigNode = function( type, children, attributes ) {
|
|
// Inheritance
|
|
ve.TwigNode.call( this );
|
|
ve.dm.BranchNode.call( this, type, children, attributes );
|
|
};
|
|
|
|
/* Methods */
|
|
|
|
/* Inheritance */
|
|
|
|
ve.extendClass( ve.dm.TwigNode, ve.dm.BranchNode );
|
|
ve.extendClass( ve.dm.TwigNode, ve.TwigNode );
|