mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-27 15:50:29 +00:00
Change 'leaf' to 'leaves' and document it
Change-Id: I09d5995d3d9bf82670802f0efe849f40be2a18a3
This commit is contained in:
parent
770775eec0
commit
32c65cdaa8
|
@ -70,7 +70,8 @@ ve.dm.Document.prototype.rebuildNodes = function( parent, index, numNodes, offse
|
|||
*
|
||||
* @method
|
||||
* @param {ve.Range} range Range within document to select nodes
|
||||
* @param {String} [mode='leaf'] Type of selection to perform, currently only 'leaf' is supported
|
||||
* @param {String} [mode='leaves'] Type of selection to perform, currently only 'leaves' is supported
|
||||
* 'leaves': Return all leaf nodes in the given range
|
||||
* @returns {Array} List of objects describing nodes in the selection and the ranges therein
|
||||
* @throws 'Invalid start offset' if range.start is out of range
|
||||
* @throws 'Invalid end offset' if range.end is out of range
|
||||
|
@ -93,7 +94,7 @@ ve.dm.Document.prototype.selectNodes = function( range, mode ) {
|
|||
endBetween;
|
||||
|
||||
// TODO needs more modes, probably. Current implementation is only for mode == 'leaf'
|
||||
if ( mode && mode !== 'leaf') {
|
||||
if ( mode && mode !== 'leaves' ) {
|
||||
throw 'Invalid mode: ' + mode;
|
||||
}
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ test( 'selectNodes', 14, function() {
|
|||
|
||||
// Test count: ( 1 test + ( 2 tests x 2 results ) ) = 5
|
||||
ve.dm.example.nodeSelectionEqual(
|
||||
doc.selectNodes( new ve.Range( 0, 10 ) ),
|
||||
doc.selectNodes( new ve.Range( 0, 10 ), 'leaves' ),
|
||||
[
|
||||
// heading/text
|
||||
{ 'node': lookup( documentNode, 0, 0 ) },
|
||||
|
|
Loading…
Reference in a new issue