mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Draggable: Don't run stop methods for elements that have been removed. Fixed #8269 - Removing draggable element on drop : a(this).data("draggable") is undefined.
This commit is contained in:
parent
4ab7d53b1c
commit
27d1023553
10
ui/jquery.ui.draggable.js
vendored
10
ui/jquery.ui.draggable.js
vendored
@ -207,8 +207,14 @@ $.widget("ui.draggable", $.ui.mouse, {
|
||||
this.dropped = false;
|
||||
}
|
||||
|
||||
//if the original element is removed, don't bother to continue
|
||||
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))) {
|
||||
|
Loading…
Reference in New Issue
Block a user