aboutsummaryrefslogtreecommitdiffstats
path: root/ui/jquery.ui.sortable.js
diff options
context:
space:
mode:
authorMartin Hoch <martin@fidion.de>2012-08-22 22:02:39 -0400
committerScott González <scott.gonzalez@gmail.com>2012-08-22 22:02:39 -0400
commit2b899cc8437c5bc16b60a01a51241e4096fd80db (patch)
tree0845427453a3e7cbb251b6d3d1ee09020b4c9870 /ui/jquery.ui.sortable.js
parent651460792b3aeb7f05cbad5dc8f7b2276bdd9b29 (diff)
downloadjquery-ui-2b899cc8437c5bc16b60a01a51241e4096fd80db.tar.gz
jquery-ui-2b899cc8437c5bc16b60a01a51241e4096fd80db.zip
Sortable: Fixed jerkiness with nested-sortables. Fixes #4857 - Nested lists don't work properly with sortable.
Diffstat (limited to 'ui/jquery.ui.sortable.js')
-rw-r--r--ui/jquery.ui.sortable.js11
1 files changed, 10 insertions, 1 deletions
diff --git a/ui/jquery.ui.sortable.js b/ui/jquery.ui.sortable.js
index 8d7b6ccb8..7e1fc185b 100644
--- a/ui/jquery.ui.sortable.js
+++ b/ui/jquery.ui.sortable.js
@@ -296,7 +296,16 @@ $.widget("ui.sortable", $.ui.mouse, {
var item = this.items[i], itemElement = item.item[0], intersection = this._intersectsWithPointer(item);
if (!intersection) continue;
- if(itemElement != this.currentItem[0] //cannot intersect with itself
+ // Only put the placeholder inside the current Container, skip all
+ // items form other containers. This works because when moving
+ // an item from one container to another the
+ // currentContainer is switched before the placeholder is moved.
+ //
+ // Without this moving items in "sub-sortables" can cause the placeholder to jitter
+ // beetween the outer and inner container.
+ if (item.instance !== this.currentContainer) continue;
+
+ if (itemElement != this.currentItem[0] //cannot intersect with itself
&& this.placeholder[intersection == 1 ? "next" : "prev"]()[0] != itemElement //no useless actions that have been done before
&& !$.contains(this.placeholder[0], itemElement) //no action if the item moved is the parent of the item checked
&& (this.options.type == 'semi-dynamic' ? !$.contains(this.element[0], itemElement) : true)