Skip to content

Commit 75a4882

Browse files
committed
Better fix for unwanted IE event capturing
1 parent 119ed2a commit 75a4882

File tree

1 file changed

+2
-47
lines changed

1 file changed

+2
-47
lines changed

Sortable.js

Lines changed: 2 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -435,29 +435,6 @@
435435
dragEl.parentNode[expando] && dragEl.parentNode[expando]._computeIsAligned(evt);
436436
},
437437

438-
_isTrueParentSortable = function(el, target) {
439-
var trueParent = target;
440-
while (!trueParent[expando]) {
441-
trueParent = trueParent.parentNode;
442-
}
443-
444-
return el === trueParent;
445-
},
446-
447-
_artificalBubble = function(sortable, originalEvt, method) {
448-
// Artificial IE bubbling
449-
var nextParent = sortable.parentNode;
450-
while (nextParent && !nextParent[expando]) {
451-
nextParent = nextParent.parentNode;
452-
}
453-
454-
if (nextParent) {
455-
nextParent[expando][method](_extend(originalEvt, {
456-
artificialBubble: true
457-
}));
458-
}
459-
},
460-
461438
_hideGhostForTarget = function() {
462439
if (!supportCssPointerEvents && ghostEl) {
463440
_css(ghostEl, 'display', 'none');
@@ -664,13 +641,6 @@
664641

665642
_saveInputCheckedState(el);
666643

667-
668-
// IE: Calls events in capture mode if event element is nested. This ensures only correct element's _onTapStart goes through.
669-
// This process is also done in _onDragOver
670-
if (IE11OrLess && !evt.artificialBubble && !_isTrueParentSortable(el, target)) {
671-
return;
672-
}
673-
674644
// Don't trigger start event when an element is been dragged, otherwise the evt.oldindex always wrong when set option.group.
675645
if (dragEl) {
676646
return;
@@ -687,12 +657,6 @@
687657

688658
target = _closest(target, options.draggable, el, false);
689659

690-
if (!target) {
691-
if (IE11OrLess) {
692-
_artificalBubble(el, evt, '_onTapStart');
693-
}
694-
return;
695-
}
696660

697661
if (lastDownEl === target) {
698662
// Ignoring duplicate `down`
@@ -1181,11 +1145,6 @@
11811145

11821146
if (_silent) return;
11831147

1184-
// IE event order fix
1185-
if (IE11OrLess && !evt.rootEl && !evt.artificialBubble && !_isTrueParentSortable(el, target)) {
1186-
return;
1187-
}
1188-
11891148
// Return invocation when dragEl is inserted (or completed)
11901149
function completed(insertion) {
11911150
if (insertion) {
@@ -1408,10 +1367,6 @@
14081367
}
14091368
}
14101369

1411-
if (IE11OrLess && !evt.rootEl) {
1412-
_artificalBubble(el, evt, '_onDragOver');
1413-
}
1414-
14151370
return false;
14161371
},
14171372

@@ -1834,12 +1789,12 @@
18341789

18351790

18361791
function _on(el, event, fn) {
1837-
el.addEventListener(event, fn, captureMode);
1792+
el.addEventListener(event, fn, IE11OrLess ? false : captureMode);
18381793
}
18391794

18401795

18411796
function _off(el, event, fn) {
1842-
el.removeEventListener(event, fn, captureMode);
1797+
el.removeEventListener(event, fn, IE11OrLess ? false : captureMode);
18431798
}
18441799

18451800

0 commit comments

Comments
 (0)