From 32c65cdaa8d0e91d28c1f517947d2b279e3ca78b Mon Sep 17 00:00:00 2001 From: Catrope Date: Mon, 7 May 2012 16:04:19 -0700 Subject: [PATCH] Change 'leaf' to 'leaves' and document it Change-Id: I09d5995d3d9bf82670802f0efe849f40be2a18a3 --- modules/ve2/dm/ve.dm.Document.js | 5 +++-- tests/ve2/dm/ve.dm.Document.test.js | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/modules/ve2/dm/ve.dm.Document.js b/modules/ve2/dm/ve.dm.Document.js index 6d78219f6d..ffc09c13d4 100644 --- a/modules/ve2/dm/ve.dm.Document.js +++ b/modules/ve2/dm/ve.dm.Document.js @@ -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; } diff --git a/tests/ve2/dm/ve.dm.Document.test.js b/tests/ve2/dm/ve.dm.Document.test.js index 29512d594c..69a9c2af96 100644 --- a/tests/ve2/dm/ve.dm.Document.test.js +++ b/tests/ve2/dm/ve.dm.Document.test.js @@ -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 ) },