From f485742d26281c078ab78b779fd271fbb73917d6 Mon Sep 17 00:00:00 2001 From: Lebedev Konstantin Date: Wed, 22 Feb 2017 11:37:43 +0300 Subject: [PATCH] #1046: fixed removing clone --- Sortable.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Sortable.js b/Sortable.js index 5693fb8a7..9c642a26d 100644 --- a/Sortable.js +++ b/Sortable.js @@ -889,6 +889,11 @@ ghostEl && ghostEl.parentNode.removeChild(ghostEl); + if (rootEl === parentEl || Sortable.active.lastPullMode !== 'clone') { + // Remove clone + cloneEl && cloneEl.parentNode.removeChild(cloneEl); + } + if (dragEl) { if (this.nativeDraggable) { _off(dragEl, 'dragend', this); @@ -905,7 +910,6 @@ newIndex = _index(dragEl, options.draggable); if (newIndex >= 0) { - // Add event _dispatchEvent(null, parentEl, 'add', dragEl, rootEl, oldIndex, newIndex); @@ -918,9 +922,6 @@ } } else { - // Remove clone - cloneEl && cloneEl.parentNode.removeChild(cloneEl); - if (dragEl.nextSibling !== nextEl) { // Get the index of the dragged element within its parent newIndex = _index(dragEl, options.draggable);