Added ve.dm.Node.getOffset

Change-Id: I4fb99040af44c063ad3b6489f2fd895d843fcf0c
This commit is contained in:
Trevor Parscal 2012-06-01 17:43:34 -07:00
parent 3ef601f04e
commit 73c5dd8f1d

View file

@ -150,6 +150,18 @@ ve.dm.Node.prototype.adjustLength = function( adjustment ) {
this.setLength( this.length + adjustment );
};
/**
* Gets the offset of this node within the document.
*
* If this node has no parent than the result will always be 0.
*
* @method
* @returns {Integer} Offset of node
*/
ve.dm.Node.prototype.getOffset = function() {
return this.root === this ? 0 : this.root.getOffsetFromNode( this );
};
/**
* Gets an element attribute value.
*