From c724964869515c7c4cd50c491461eb45e15a8197 Mon Sep 17 00:00:00 2001 From: RomualdoGrillo Date: Sat, 4 Apr 2020 12:25:10 +0200 Subject: [PATCH] Solves "inser Before" issue on nested lists MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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” --- src/Sortable.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Sortable.js b/src/Sortable.js index 7a096301d..89b3a20e4 100644 --- a/src/Sortable.js +++ b/src/Sortable.js @@ -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);