mediawiki-extensions-Visual.../modules/ve/ce/ve.ce.DomRange.js
Timo Tijhof 8f05cdbf70 doc: Add placeholders for unindexed methods
Not having a description yet is fine, but they should at least
be indexed as blocks so that they are searchable and listed
in the jsduck generated pages. jsduck defaults to @method + name
of prototype property. And it even guesses parameters sometimes.

Search: \n\n([a-zA-Z\.]+\.prototype\.[a-zA-Z]+)
Where: modules/ve,modules/ve-mw
Where-Not: modules/ve/test
Replace: \n\n/** */\n$1

Added @return in a few places where it was easy to add.

Change-Id: I830c94cc7dbc261bd7a077391f930cbfff165f9d
2013-07-31 23:00:30 +00:00

53 lines
1.3 KiB
JavaScript

/*!
* VisualEditor DomRange class.
*
* @copyright 2011-2013 VisualEditor Team and others; see AUTHORS.txt
* @license The MIT License (MIT); see LICENSE.txt
*/
/**
* DomRange.
*
* @class
* @constructor
* @param {HTMLElement} focusNode Selection focus node
* @param {number} focusOffset Selection focus offset
* @param {HTMLElement} anchorNode Selection anchor node
* @param {number} anchorOffset Selection anchor offset
*/
ve.ce.DomRange = function VeCeDomRange( focusNode, focusOffset, anchorNode, anchorOffset ) {
this.focusNode = focusNode;
this.focusOffset = focusOffset;
this.anchorNode = anchorNode;
this.anchorOffset = anchorOffset;
};
/* Static Methods */
ve.ce.DomRange.newFromDomSelection = function ( selection ) {
return new ve.ce.DomRange(
selection.focusNode, selection.focusOffset, selection.anchorNode, selection.anchorOffset
);
};
/* Methods */
/** */
ve.ce.DomRange.prototype.equals = function ( other ) {
return other &&
this.focusNode === other.focusNode &&
this.focusOffset === other.focusOffset &&
this.anchorNode === other.anchorNode &&
this.anchorOffset === other.anchorOffset;
};
/**
* @return {ve.Range}
*/
ve.ce.DomRange.prototype.getRange = function () {
return new ve.Range(
ve.ce.getOffset( this.anchorNode, this.anchorOffset ),
ve.ce.getOffset( this.focusNode, this.focusOffset )
);
};