]> source.dussan.org Git - jquery-ui.git/commitdiff
Sortable: Fixed jerkiness with nested-sortables. Fixes #4857 - Nested lists don't...
authorMartin Hoch <martin@fidion.de>
Thu, 23 Aug 2012 02:02:39 +0000 (22:02 -0400)
committerScott González <scott.gonzalez@gmail.com>
Thu, 23 Aug 2012 02:05:29 +0000 (22:05 -0400)
(cherry picked from commit 2b899cc8437c5bc16b60a01a51241e4096fd80db)

ui/jquery.ui.sortable.js

index 403fc53ebe1792963e0564471a88f190aa9ebd59..8f806c6cc085a129f72742984bc926dbada4b1e0 100644 (file)
@@ -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
                                &&      !$.ui.contains(this.placeholder[0], itemElement) //no action if the item moved is the parent of the item checked
                                && (this.options.type == 'semi-dynamic' ? !$.ui.contains(this.element[0], itemElement) : true)