Skip to content

Commit

Permalink
Sortable: Fix a bug of removing an item while iterating an array. Fix…
Browse files Browse the repository at this point in the history
…es #8571 - Out of range problem in when dragging a nested sortable.
  • Loading branch information
zhizhangchen authored and scottgonzalez committed Oct 10, 2012
1 parent a3f1a34 commit 77a4aaf
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions ui/jquery.ui.sortable.js
Expand Up @@ -562,14 +562,13 @@ $.widget("ui.sortable", $.ui.mouse, {

var list = this.currentItem.find(":data(" + this.widgetName + "-item)");

for (var i=0; i < this.items.length; i++) {

this.items = $.grep(this.items, function (item) {
for (var j=0; j < list.length; j++) {
if(list[j] == this.items[i].item[0])
this.items.splice(i,1);
if(list[j] == item.item[0])
return false;
};

};
return true;
});

},

Expand Down

0 comments on commit 77a4aaf

Please sign in to comment.