diff --git a/.gitignore b/.gitignore index bb83eae77..cbfdeec11 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ mock.png .build* jquery.fn.* .idea/ +.vscode diff --git a/Sortable.js b/Sortable.js index 11b7cec3e..b40b4b152 100644 --- a/Sortable.js +++ b/Sortable.js @@ -2109,6 +2109,10 @@ let elLastChild = lastChild(el, options.draggable); + if (rootEl !== el) { + elLastChild = null; + } + if ( !elLastChild || (_ghostIsLast(evt, vertical, this) && !elLastChild.animated) diff --git a/modular/sortable.complete.esm.js b/modular/sortable.complete.esm.js index 34995a3a4..d92a9f9e8 100644 --- a/modular/sortable.complete.esm.js +++ b/modular/sortable.complete.esm.js @@ -2103,6 +2103,10 @@ Sortable.prototype = /** @lends Sortable.prototype */ { let elLastChild = lastChild(el, options.draggable); + if (rootEl !== el) { + elLastChild = null; + } + if ( !elLastChild || (_ghostIsLast(evt, vertical, this) && !elLastChild.animated) diff --git a/modular/sortable.core.esm.js b/modular/sortable.core.esm.js index 0801811b7..868d555bf 100644 --- a/modular/sortable.core.esm.js +++ b/modular/sortable.core.esm.js @@ -2103,6 +2103,10 @@ Sortable.prototype = /** @lends Sortable.prototype */ { let elLastChild = lastChild(el, options.draggable); + if (rootEl !== el) { + elLastChild = null; + } + if ( !elLastChild || (_ghostIsLast(evt, vertical, this) && !elLastChild.animated) diff --git a/modular/sortable.esm.js b/modular/sortable.esm.js index 27cc75e24..656f71cd7 100644 --- a/modular/sortable.esm.js +++ b/modular/sortable.esm.js @@ -2103,6 +2103,10 @@ Sortable.prototype = /** @lends Sortable.prototype */ { let elLastChild = lastChild(el, options.draggable); + if (rootEl !== el) { + elLastChild = null; + } + if ( !elLastChild || (_ghostIsLast(evt, vertical, this) && !elLastChild.animated) diff --git a/src/Sortable.js b/src/Sortable.js index f66d23cf9..0ba013c72 100644 --- a/src/Sortable.js +++ b/src/Sortable.js @@ -1268,6 +1268,10 @@ Sortable.prototype = /** @lends Sortable.prototype */ { let elLastChild = lastChild(el, options.draggable); + if (rootEl !== el) { + elLastChild = null + } + if ( !elLastChild || (_ghostIsLast(evt, vertical, this) && !elLastChild.animated)