From 7fd16cb0a573159bc36b2590567f186df295704a Mon Sep 17 00:00:00 2001 From: RubaXa Date: Tue, 15 Sep 2015 22:11:45 +0300 Subject: [PATCH] #447: fixed newIndex if eq null or -1 --- Sortable.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Sortable.js b/Sortable.js index 3faf0a0..caa55e1 100644 --- a/Sortable.js +++ b/Sortable.js @@ -791,8 +791,11 @@ } } - if (newIndex >= 0) { - // Only if we really move the item. + if (Sortable.active) { + if (newIndex == null || newIndex === -1) { + newIndex = oldIndex; + } + _dispatchEvent(this, rootEl, 'end', dragEl, rootEl, oldIndex, newIndex); // Save sorting