Skip to content
Permalink
Browse files

Sortable: Fix a bug of removing an item while iterating an array. Fix…

…es #8571 - Out of range problem in when dragging a nested sortable.
  • Loading branch information...
zhizhangchen authored and scottgonzalez committed Sep 12, 2012
1 parent a3f1a34 commit 77a4aaf47abe08f11eb4e0eabdb2a1c026c0f221
Showing with 5 additions and 6 deletions.
  1. +5 −6 ui/jquery.ui.sortable.js
@@ -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;
});

},

0 comments on commit 77a4aaf

Please sign in to comment.
You can’t perform that action at this time.