Browse Source

Fixed fallback not working if elements were in ShadowRoot

pull/1282/head
Wiktor Olejniczak 7 years ago
parent
commit
ca5fee7048
  1. 18
      Sortable.js
  2. 2
      Sortable.min.js

18
Sortable.js

@ -336,7 +336,7 @@
type = evt.type, type = evt.type,
touch = evt.touches && evt.touches[0], touch = evt.touches && evt.touches[0],
target = (touch || evt).target, target = (touch || evt).target,
originalTarget = evt.target.shadowRoot && (evt.path && evt.path[0]) || target, originalTarget = target,
filter = options.filter, filter = options.filter,
startIndex; startIndex;
@ -551,14 +551,16 @@
_css(ghostEl, 'display', 'none'); _css(ghostEl, 'display', 'none');
} }
var target = document.elementFromPoint(touchEvt.clientX, touchEvt.clientY); var shadowRootOrDocument = document;
var parent = target; // Check for Shadow DOM
var i = touchDragOverListeners.length; for (var node = this.el; node; node = node.parentNode) {
if (node.toString() === "[object ShadowRoot]") {
if (target && target.shadowRoot) { shadowRootOrDocument = node;
target = target.shadowRoot.elementFromPoint(touchEvt.clientX, touchEvt.clientY); }
parent = target;
} }
var target = shadowRootOrDocument.elementFromPoint(touchEvt.clientX, touchEvt.clientY),
parent = target,
i = touchDragOverListeners.length;
if (parent) { if (parent) {
do { do {

2
Sortable.min.js vendored

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save