Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions src/Sortable.js
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ let nearestEmptyInsertDetectEvent = function(evt) {

let _checkOutsideTargetEl = function(evt) {
if (dragEl) {
dragEl.parentNode[expando]._isOutsideThisEl(evt.target);
dragEl.parentNode && dragEl.parentNode[expando]._isOutsideThisEl(evt.target);
}
};

Expand Down Expand Up @@ -774,7 +774,7 @@ Sortable.prototype = /** @lends Sortable.prototype */ {
parent = target;
}

dragEl.parentNode[expando]._isOutsideThisEl(target);
dragEl.parentNode && dragEl.parentNode[expando]._isOutsideThisEl(target);

if (parent) {
do {
Expand Down Expand Up @@ -1101,7 +1101,7 @@ Sortable.prototype = /** @lends Sortable.prototype */ {

// no bubbling and not fallback
if (!options.dragoverBubble && !evt.rootEl && target !== document) {
dragEl.parentNode[expando]._isOutsideThisEl(evt.target);
dragEl.parentNode && dragEl.parentNode[expando]._isOutsideThisEl(evt.target);

// Do not detect for empty insert if already inserted
!insertion && nearestEmptyInsertDetectEvent(evt);
Expand Down Expand Up @@ -1327,6 +1327,13 @@ Sortable.prototype = /** @lends Sortable.prototype */ {
if (el.contains(dragEl)) {
return completed(false);
}
} else {
// unmounted dragEl from previous target who is dragging over a new target but can not be dropped
if (putSortable && putSortable.lastPutMode !== 'clone') {
rootEl.appendChild(dragEl);
} else if (rootEl !== dragEl.parentNode) {
dragEl.parentNode && dragEl.parentNode.removeChild(dragEl);
}
}

return false;
Expand Down