mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-12-01 01:16:30 +00:00
Added ve.dm.Node.getOffset
Change-Id: I4fb99040af44c063ad3b6489f2fd895d843fcf0c
This commit is contained in:
parent
3ef601f04e
commit
73c5dd8f1d
|
@ -150,6 +150,18 @@ ve.dm.Node.prototype.adjustLength = function( adjustment ) {
|
||||||
this.setLength( this.length + 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.
|
* Gets an element attribute value.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in a new issue