Index: trunk/extensions/VisualEditor/modules/es/bases/es.DocumentBranchNode.js |
— | — | @@ -263,7 +263,8 @@ |
264 | 264 | * @param {es.Range} range Range to select nodes within |
265 | 265 | * @param {Boolean} [shallow] Do not recurse into child nodes of child nodes |
266 | 266 | * @returns {Array} List of objects with 'node', 'range' and 'globalRange' properties describing nodes which are |
267 | | - * covered by the range and the range within the node that is covered |
| 267 | + * covered by the range and the range within the node that is covered. If an entire node is covered, 'range' is |
| 268 | + * absent but 'globalRange' is still set |
268 | 269 | */ |
269 | 270 | es.DocumentBranchNode.prototype.selectNodes = function( range, shallow ) { |
270 | 271 | if ( typeof range === 'undefined' ) { |
— | — | @@ -360,19 +361,19 @@ |
361 | 362 | // end is between childNode and this.children[i+1] |
362 | 363 | // start is not inside childNode, so the selection covers |
363 | 364 | // all of childNode, then ends |
364 | | - nodes.push( { 'node': childNode } ); |
| 365 | + nodes.push( { 'node': childNode, 'globalRange': new es.Range( left - 1, right + 1 ) } ); |
365 | 366 | // We've reached the end so we're done |
366 | 367 | return nodes; |
367 | 368 | } else if ( start == left - 1 ) { |
368 | 369 | // start is between this.children[i-1] and childNode |
369 | 370 | // end is not inside childNode, so the selection covers |
370 | 371 | // all of childNode and more |
371 | | - nodes.push( { 'node': childNode } ); |
| 372 | + nodes.push( { 'node': childNode, 'globalRange': new es.Range( left - 1, right + 1 ) } ); |
372 | 373 | } else if ( nodes.length > 0 ) { |
373 | 374 | // Neither the start nor the end is inside childNode, but nodes is non-empty, |
374 | 375 | // so childNode must be between the start and the end |
375 | 376 | // Add the entire node, so no range property |
376 | | - nodes.push( { 'node': childNode } ); |
| 377 | + nodes.push( { 'node': childNode, 'globalRange': new es.Range( left - 1, right + 1 ) } ); |
377 | 378 | } |
378 | 379 | |
379 | 380 | // Move left to the start of this.children[i+1] for the next iteration |