From 92a7deae2a9699a6921aeb063f8c12b0c26ce45a Mon Sep 17 00:00:00 2001 From: RubaXa Date: Sun, 13 Dec 2015 15:29:01 +0300 Subject: [PATCH] #687: fixed 'parentEl' --- Sortable.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Sortable.js b/Sortable.js index 7876b07..83dbabf 100644 --- a/Sortable.js +++ b/Sortable.js @@ -260,10 +260,12 @@ target = (touch || evt).target, originalTarget = target, filter = options.filter; - // don't trigger start event when an element is been dragged, otherwise the evt.oldindex always wrong when set option.group. + + // Don't trigger start event when an element is been dragged, otherwise the evt.oldindex always wrong when set option.group. if (dragEl) { return; } + if (type === 'mousedown' && evt.button !== 0 || options.disabled) { return; // only left button or enabled } @@ -278,7 +280,7 @@ return; } - // get the index of the dragged element within its parent + // Get the index of the dragged element within its parent oldIndex = _index(target, options.draggable); // Check filter @@ -613,6 +615,7 @@ if (revert) { _cloneHide(true); + parentEl = rootEl; // actualization if (cloneEl || nextEl) { rootEl.insertBefore(dragEl, cloneEl || nextEl);