2012-04-27 21:59:52 +00:00
|
|
|
/**
|
2012-05-01 00:36:22 +00:00
|
|
|
* DataModel node for a document.
|
2012-04-27 21:59:52 +00:00
|
|
|
*
|
|
|
|
* @class
|
|
|
|
* @constructor
|
|
|
|
* @extends {ve.dm.LeafNode}
|
|
|
|
* @param {Integer} [length] Length of content data in document
|
|
|
|
*/
|
|
|
|
ve.dm.TextNode = function( length ) {
|
|
|
|
// Inheritance
|
|
|
|
ve.dm.LeafNode.call( this, 'text', length );
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Static Members */
|
|
|
|
|
2012-04-30 22:47:54 +00:00
|
|
|
/**
|
|
|
|
* @see ve.dm.NodeFactory
|
|
|
|
*/
|
2012-04-27 21:59:52 +00:00
|
|
|
ve.dm.TextNode.rules = {
|
|
|
|
'canHaveChildren': false,
|
|
|
|
'canHaveGrandchildren': false,
|
|
|
|
'childNodeTypes': [],
|
|
|
|
'parentNodeTypes': null
|
|
|
|
};
|
|
|
|
|
2012-04-30 20:23:46 +00:00
|
|
|
/* Methods */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the outer length, which for a text node is the same as the inner length.
|
|
|
|
*
|
|
|
|
* @method
|
|
|
|
* @returns {Integer} Length of the entire node
|
|
|
|
*/
|
|
|
|
ve.dm.TextNode.prototype.getOuterLength = function() {
|
|
|
|
return this.length;
|
|
|
|
};
|
|
|
|
|
2012-04-27 21:59:52 +00:00
|
|
|
/* Registration */
|
|
|
|
|
|
|
|
ve.dm.factory.register( 'text', ve.dm.TextNode );
|
|
|
|
|
|
|
|
/* Inheritance */
|
|
|
|
|
|
|
|
ve.extendClass( ve.dm.TextNode, ve.dm.LeafNode );
|