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

100% Statements 9/9
100% Branches 2/2
100% Functions 2/2
100% Lines 9/9

Press n or j to go to the next uncovered block, b, p or k for the previous block.

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                                    1x   6571x     6571x         1x   1x       1x   1x                       1x 96x    
/*!
 * VisualEditor DataModel LeafNode class.
 *
 * @copyright See AUTHORS.txt
 */
 
/**
 * DataModel leaf node.
 *
 * Leaf nodes can not have any children.
 *
 * @abstract
 * @extends ve.dm.Node
 * @mixes 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 || [];
};