mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-10-05 01:44:18 +00:00
Sortable: Make sure we have a placeholder before trying to remove it during a cancel. Fixes #6879 - Sortable: Calling cancel when there is no sort occurring throws an error.
This commit is contained in:
parent
cf0c32f335
commit
f165c93127
2
ui/jquery.ui.sortable.js
vendored
2
ui/jquery.ui.sortable.js
vendored
@ -377,6 +377,7 @@ $.widget("ui.sortable", $.ui.mouse, {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.placeholder) {
|
||||||
//$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node!
|
//$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node!
|
||||||
if(this.placeholder[0].parentNode) this.placeholder[0].parentNode.removeChild(this.placeholder[0]);
|
if(this.placeholder[0].parentNode) this.placeholder[0].parentNode.removeChild(this.placeholder[0]);
|
||||||
if(this.options.helper != "original" && this.helper && this.helper[0].parentNode) this.helper.remove();
|
if(this.options.helper != "original" && this.helper && this.helper[0].parentNode) this.helper.remove();
|
||||||
@ -393,6 +394,7 @@ $.widget("ui.sortable", $.ui.mouse, {
|
|||||||
} else {
|
} else {
|
||||||
$(this.domPosition.parent).prepend(this.currentItem);
|
$(this.domPosition.parent).prepend(this.currentItem);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user