Skip to content

Commit d373ea0

Browse files
committed
#1434: Target must be immediate child of sortable
1 parent aca3a25 commit d373ea0

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

Sortable.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@
501501
scrollSensitivity: 30,
502502
scrollSpeed: 10,
503503
bubbleScroll: true,
504-
draggable: /[uo]l/i.test(el.nodeName) ? 'li' : '>*',
504+
draggable: /[uo]l/i.test(el.nodeName) ? '>li' : '>*',
505505
swapThreshold: 1, // percentage; 0 <= x <= 1
506506
invertSwap: false, // invert always
507507
invertedSwapThreshold: null, // will be set to same as swapThreshold if default
@@ -1210,7 +1210,7 @@
12101210
return completed();
12111211
}
12121212
}
1213-
else if (target && target !== dragEl && (target.parentNode[expando] !== void 0) && target !== el) {
1213+
else if (target && target !== dragEl && target.parentNode === el) {
12141214
var direction = 0,
12151215
targetBeforeFirstSwap,
12161216
aligned = target.sortableMouseAligned,
@@ -1691,7 +1691,14 @@
16911691
ctx = ctx || document;
16921692

16931693
do {
1694-
if ((selector === '>*' && el.parentNode === ctx) || _matches(el, selector) || (includeCTX && el === ctx)) {
1694+
if (
1695+
selector != null &&
1696+
(
1697+
selector[0] === '>' && el.parentNode === ctx && _matches(el, selector.substring(1)) ||
1698+
_matches(el, selector) ||
1699+
(includeCTX && el === ctx)
1700+
)
1701+
) {
16951702
return el;
16961703
}
16971704

0 commit comments

Comments
 (0)