From e03656d860c11aa872c59247a6c5e877e477044c Mon Sep 17 00:00:00 2001 From: mkun Date: Wed, 2 Dec 2015 14:50:38 -0300 Subject: [PATCH] Sometimes evt.from is different from evt.item.parentNode because the item has been moved already so using evt.item.nextSibling won't work when doing evt.from.insertBefore, because nextSibling is not a child of evt.from. So in those cases we use evt.clone.nextSibling instead. --- ng-sortable.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ng-sortable.js b/ng-sortable.js index 55a502d..8cc7dee 100644 --- a/ng-sortable.js +++ b/ng-sortable.js @@ -132,7 +132,7 @@ return opts; }, { onStart: function (/**Event*/evt) { - nextSibling = evt.item.nextSibling; + nextSibling = evt.from === evt.item.parentNode ? evt.item.nextSibling : evt.clone.nextSibling; _emitEvent(evt); scope.$apply(); },