Skip to content

Commit

Permalink
Don't throw exception for large select ranges
Browse files Browse the repository at this point in the history
Selection can't currently handle large selection ranges because it
drops nodes that are far away from the currently visible range. Emit
a warning rather than throwing an exception when this happens.

Fixes dojo#705 (sort of)
  • Loading branch information
jason0x43 committed Dec 21, 2013
1 parent aef5e01 commit eabea2e
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions Selection.js
Original file line number Diff line number Diff line change
Expand Up @@ -500,13 +500,17 @@ return declare(null, {
if(!toRow.element){
toRow = this.row(toRow);
}
toElement = toRow.element;
// find if it is earlier or later in the DOM
traverser = (toElement && (toElement.compareDocumentPosition ?
toElement.compareDocumentPosition(element) == 2 :
toElement.sourceIndex > element.sourceIndex)) ? "down" : "up";
while(row.element != toElement && (row = this[traverser](row))){
this._select(row, null, value);
if(toRow){
toElement = toRow.element;
// find if it is earlier or later in the DOM
traverser = (toElement && (toElement.compareDocumentPosition ?
toElement.compareDocumentPosition(element) == 2 :
toElement.sourceIndex > element.sourceIndex)) ? "down" : "up";
while(row.element != toElement && (row = this[traverser](row))){
this._select(row, null, value);
}
}else{
console.warn('select range too large')
}
}
}
Expand Down

0 comments on commit eabea2e

Please sign in to comment.