all files / src/dm/ ve.dm.LeafNode.js

100% Statements 9/9
100% Branches 2/2
100% Functions 2/2
100% Lines 9/9
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52                                      5276×     5276×                                         80×    
/*!
 * VisualEditor DataModel LeafNode class.
 *
 * @copyright 2011-2019 VisualEditor Team and others; see http://ve.mit-license.org
 */
 
/**
 * DataModel leaf node.
 *
 * Leaf nodes can not have any children.
 *
 * @abstract
 * @extends ve.dm.Node
 * @mixins ve.LeafNode
 *
 * @constructor
 * @param {Object} [element] Reference to element in linear model
 */
ve.dm.LeafNode = function VeDmLeafNode() {
	// Mixin constructor
	ve.LeafNode.call( this );
 
	// Parent constructor
	ve.dm.LeafNode.super.apply( this, arguments );
};
 
/* Inheritance */
 
OO.inheritClass( ve.dm.LeafNode, ve.dm.Node );
 
OO.mixinClass( ve.dm.LeafNode, ve.LeafNode );
 
/* Static properties */
 
ve.dm.LeafNode.static.childNodeTypes = [];
 
ve.dm.LeafNode.static.isDiffedAsLeaf = true;
 
/* Methods */
 
/**
 * Get the annotations that apply to the node.
 *
 * Annotations are grabbed directly from the linear model, so they are updated live. If the linear
 * model element doesn't have a .annotations property, an empty array is returned.
 *
 * @return {number[]} Annotation set indexes in the index-value store
 */
ve.dm.LeafNode.prototype.getAnnotations = function () {
	return this.element.annotations || [];
};