From 27ed20715f4b3e256f5279825ac551bbfcdfbe81 Mon Sep 17 00:00:00 2001 From: Mike Sherov Date: Sun, 24 Aug 2014 21:08:02 -0400 Subject: [PATCH] Draggable: Ensure css is always restored after connectToSortable drag Fixes #9675 --- ui/draggable.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/ui/draggable.js b/ui/draggable.js index d290ea539..ba8eca42b 100644 --- a/ui/draggable.js +++ b/ui/draggable.js @@ -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 -- 2.39.5