]> source.dussan.org Git - jquery-ui.git/commitdiff
Draggable: Don't run stop methods for elements that have been removed. Fixed #8269...
authorScott González <scott.gonzalez@gmail.com>
Mon, 30 Apr 2012 16:41:20 +0000 (12:41 -0400)
committerScott González <scott.gonzalez@gmail.com>
Mon, 30 Apr 2012 16:41:20 +0000 (12:41 -0400)
(cherry picked from commit 27d10235539e0f5baad6ee7e8d3d91cab65e2cfd)

Conflicts:

ui/jquery.ui.draggable.js

ui/jquery.ui.draggable.js

index d294b2d22e2d0b7812b80740d2ef6b87d3be899b..32a753ead52ae3371674b16dd03ee977d5deff9f 100644 (file)
@@ -208,8 +208,14 @@ $.widget("ui.draggable", $.ui.mouse, {
                        this.dropped = false;
                }
                
-               //if the original element is removed, don't bother to continue if helper is set to "original"
-               if((!this.element[0] || !this.element[0].parentNode) && this.options.helper == "original")
+               //if the original element is no longer in the DOM don't bother to continue (see #8269)
+               var element = this.element[0], elementInDom = false;
+               while ( element && (element = element.parentNode) ) {
+                       if (element == document ) {
+                               elementInDom = true;
+                       }
+               }
+               if ( !elementInDom && this.options.helper === "original" )
                        return false;
 
                if((this.options.revert == "invalid" && !dropped) || (this.options.revert == "valid" && dropped) || this.options.revert === true || ($.isFunction(this.options.revert) && this.options.revert.call(this.element, dropped))) {