aboutsummaryrefslogtreecommitdiffstats
path: root/ui/jquery.ui.sortable.js
diff options
context:
space:
mode:
authorJohn Chen <zhang.z.chen@intel.com>2012-09-12 17:37:04 +0800
committerScott González <scott.gonzalez@gmail.com>2012-10-10 14:39:38 -0400
commit77a4aaf47abe08f11eb4e0eabdb2a1c026c0f221 (patch)
tree7243fa38e7a79daaa3d91bff7851482e73f608bd /ui/jquery.ui.sortable.js
parenta3f1a34d3b997550a5a8cf4c630e6580cd37cde5 (diff)
downloadjquery-ui-77a4aaf47abe08f11eb4e0eabdb2a1c026c0f221.tar.gz
jquery-ui-77a4aaf47abe08f11eb4e0eabdb2a1c026c0f221.zip
Sortable: Fix a bug of removing an item while iterating an array. Fixes #8571 - Out of range problem in when dragging a nested sortable.
Diffstat (limited to 'ui/jquery.ui.sortable.js')
-rw-r--r--ui/jquery.ui.sortable.js11
1 files changed, 5 insertions, 6 deletions
diff --git a/ui/jquery.ui.sortable.js b/ui/jquery.ui.sortable.js
index 920e645d4..0768fdf6e 100644
--- a/ui/jquery.ui.sortable.js
+++ b/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;
+ });
},