mirror of
https://github.com/jquery/jquery-ui.git
synced 2025-01-07 20:34:24 +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.
(cherry picked from commit f165c93127
)
This commit is contained in:
parent
465c4c2cbe
commit
1ce8cf885f
28
ui/jquery.ui.sortable.js
vendored
28
ui/jquery.ui.sortable.js
vendored
@ -378,21 +378,23 @@ $.widget("ui.sortable", $.ui.mouse, {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node!
|
if (this.placeholder) {
|
||||||
if(this.placeholder[0].parentNode) this.placeholder[0].parentNode.removeChild(this.placeholder[0]);
|
//$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node!
|
||||||
if(this.options.helper != "original" && this.helper && this.helper[0].parentNode) this.helper.remove();
|
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();
|
||||||
|
|
||||||
$.extend(this, {
|
$.extend(this, {
|
||||||
helper: null,
|
helper: null,
|
||||||
dragging: false,
|
dragging: false,
|
||||||
reverting: false,
|
reverting: false,
|
||||||
_noFinalSort: null
|
_noFinalSort: null
|
||||||
});
|
});
|
||||||
|
|
||||||
if(this.domPosition.prev) {
|
if(this.domPosition.prev) {
|
||||||
$(this.domPosition.prev).after(this.currentItem);
|
$(this.domPosition.prev).after(this.currentItem);
|
||||||
} 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