]> source.dussan.org Git - jquery-ui.git/commitdiff
Draggable: Ensure css is always restored after connectToSortable drag
authorMike Sherov <mike.sherov@gmail.com>
Mon, 25 Aug 2014 01:08:02 +0000 (21:08 -0400)
committerMike Sherov <mike.sherov@gmail.com>
Mon, 25 Aug 2014 12:24:56 +0000 (08:24 -0400)
Fixes #9675

ui/draggable.js

index d290ea539b82466c70960e6bb29ffc2b0662cfb4..ba8eca42b3568ed3b2370d8b3a14b0c003de0eaf 100644 (file)
@@ -744,19 +744,20 @@ $.ui.plugin.add("draggable", "connectToSortable", {
                                if (this.shouldRevert) {
                                        this.instance.options.revert = this.shouldRevert;
                                }
+                               // Use _storedCSS To restore properties in the sortable,
+                               // as this also handles revert (#9675) since the draggable
+                               // may have modified them in unexpected ways (#8809)
+                               this.instance._storedCSS = {
+                                       position: this.instance.placeholder.css( "position" ),
+                                       top: this.instance.placeholder.css( "top" ),
+                                       left: this.instance.placeholder.css( "left" )
+                               };
 
                                //Trigger the stop of the sortable
                                this.instance._mouseStop(event);
 
                                this.instance.options.helper = this.instance.options._helper;
 
-                               // restore properties in the sortable, since the draggable may have
-                               // modified them in unexpected ways (#8809)
-                               this.instance.currentItem.css({
-                                       position: this.instance.placeholder.css( "position" ),
-                                       top: "",
-                                       left: ""
-                               });
                        } else {
                                // Prevent this Sortable from removing the helper.
                                // However, don't set the draggable to remove the helper