From a22f9c1fc784b8dd92a2d3cb049e337a0410fa44 Mon Sep 17 00:00:00 2001 From: Roel van Duijnhoven Date: Thu, 18 Dec 2014 12:18:02 +0100 Subject: [PATCH] Sort event does not always fire In the dev branch the `sort` event is not always correctly called on the receiving list. This IS working in the latest released branch. The fix is trivial and included in this PR. The case is illustrated in this JsBin: http://jsbin.com/muxojulevo/3/edit. It occurs whenever an item is picked up from a list and dropped in a nested container. --- Sortable.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sortable.js b/Sortable.js index ab53768..58c92f9 100644 --- a/Sortable.js +++ b/Sortable.js @@ -601,7 +601,7 @@ _disableDraggable(dragEl); _toggleClass(dragEl, this.options.ghostClass, false); - if (!rootEl.contains(dragEl)) { + if (rootEl !== dragEl.parentNode) { // drag from one list and drop into another _dispatchEvent(dragEl.parentNode, 'sort', dragEl, rootEl, startIndex, newIndex); _dispatchEvent(rootEl, 'sort', dragEl, rootEl, startIndex, newIndex);