Skip to content

Commit c724964

Browse files
Solves "inser Before" issue on nested lists
That solves an issue with nested sortables. example of error https://codepen.io/romualdogrillo/pen/jOPoRJe An error appears when all following conditions are met: 1)You have two nested sortable containers 2)option “pull:clone” i set at least on the parent container 3)You drag an item from the parent container into the nested container The item is moved but not cloned and you get the error: “Failed to execute 'insertBefore' on 'Node': The node before which the new node is to be inserted”
1 parent c36f49b commit c724964

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Sortable.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1692,7 +1692,7 @@ Sortable.prototype = /** @lends Sortable.prototype */ {
16921692
if (Sortable.eventCanceled) return;
16931693

16941694
// show clone at dragEl or original position
1695-
if (rootEl.contains(dragEl) && !this.options.group.revertClone) {
1695+
if (dragEl.parentNode == rootEl && !this.options.group.revertClone) {
16961696
rootEl.insertBefore(cloneEl, dragEl);
16971697
} else if (nextEl) {
16981698
rootEl.insertBefore(cloneEl, nextEl);

0 commit comments

Comments
 (0)