Skip to content

Commit

Permalink
Solves "inser Before" issue on nested lists
Browse files Browse the repository at this point in the history
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”
  • Loading branch information
RomualdoGrillo authored Apr 4, 2020
1 parent c36f49b commit c724964
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Sortable.js
Original file line number Diff line number Diff line change
Expand Up @@ -1692,7 +1692,7 @@ Sortable.prototype = /** @lends Sortable.prototype */ {
if (Sortable.eventCanceled) return;

// show clone at dragEl or original position
if (rootEl.contains(dragEl) && !this.options.group.revertClone) {
if (dragEl.parentNode == rootEl && !this.options.group.revertClone) {
rootEl.insertBefore(cloneEl, dragEl);
} else if (nextEl) {
rootEl.insertBefore(cloneEl, nextEl);
Expand Down

0 comments on commit c724964

Please sign in to comment.