]> source.dussan.org Git - jquery-ui.git/commitdiff
Sortable: cancelHelperRemoval only considers helper, not placeholder
authorMike Sherov <mike.sherov@gmail.com>
Mon, 25 Aug 2014 14:28:39 +0000 (10:28 -0400)
committerMike Sherov <mike.sherov@gmail.com>
Tue, 26 Aug 2014 13:52:00 +0000 (09:52 -0400)
Refs #9675

tests/unit/draggable/draggable_options.js
ui/sortable.js

index 46b80608cb149779e6078c6926b521261c574004..6c4a593961c7172b355693f2274aeb357b8d04c3 100644 (file)
@@ -305,7 +305,7 @@ test( "connectToSortable, dragging clone into sortable", function() {
                sortable = $( "#sortable" ).sortable(),
                offsetSortable = sortable.offset();
 
-       $( sortable ).one( "sortbeforestop", function( event, ui ) {
+       $( sortable ).one( "sort", function( event, ui ) {
                // http://bugs.jqueryui.com/ticket/8809
                // Position issue when connected to sortable
                deepEqual( ui.helper.offset(), offsetSortable, "sortable offset is correct" );
index da4d13117120bafbf4866d7586614faa340cd856..0207c86206d258ad995e71f114c27690bf41db7d 100644 (file)
@@ -1253,18 +1253,6 @@ return $.widget("ui.sortable", $.ui.mouse, {
                }
 
                this.dragging = false;
-               if(this.cancelHelperRemoval) {
-                       if(!noPropagation) {
-                               this._trigger("beforeStop", event, this._uiHash());
-                               for (i=0; i < delayedTriggers.length; i++) {
-                                       delayedTriggers[i].call(this, event);
-                               } //Trigger all delayed events
-                               this._trigger("stop", event, this._uiHash());
-                       }
-
-                       this.fromOutside = false;
-                       return false;
-               }
 
                if(!noPropagation) {
                        this._trigger("beforeStop", event, this._uiHash());
@@ -1273,10 +1261,12 @@ return $.widget("ui.sortable", $.ui.mouse, {
                //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node!
                this.placeholder[0].parentNode.removeChild(this.placeholder[0]);
 
-               if(this.helper[0] !== this.currentItem[0]) {
-                       this.helper.remove();
+               if ( !this.cancelHelperRemoval ) {
+                       if ( this.helper[ 0 ] !== this.currentItem[ 0 ] ) {
+                               this.helper.remove();
+                       }
+                       this.helper = null;
                }
-               this.helper = null;
 
                if(!noPropagation) {
                        for (i=0; i < delayedTriggers.length; i++) {
@@ -1286,7 +1276,7 @@ return $.widget("ui.sortable", $.ui.mouse, {
                }
 
                this.fromOutside = false;
-               return true;
+               return !this.cancelHelperRemoval;
 
        },