Skip to content

armgit / anime

Public Imported from GitHub
0

JavaScript animation engine

Simply check for parentElement instead parentNode

Julian Garnierbe281290c6e7
diff --git a/src/draggable.js b/src/draggable.js
index 461957c1..163aa233 100644
--- a/src/draggable.js
+++ b/src/draggable.js
@@ -936,23 +936,17 @@ export class Draggable {
let canTouchScroll = false;
while (touches && $parent && $parent !== this.$trigger) {
- if ($parent.nodeType === Node.ELEMENT_NODE) {
- const overflowY = getTargetValue($parent, 'overflow-y');
- if (overflowY !== 'hidden' && overflowY !== 'visible') {
- const { scrollTop, scrollHeight, clientHeight } = $parent;
- if (scrollHeight > clientHeight) {
- canTouchScroll = true;
- isAtTop = scrollTop <= 3;
- isAtBottom = scrollTop >= (scrollHeight - clientHeight) - 3;
- break;
- }
+ const overflowY = getTargetValue($parent, 'overflow-y');
+ if (overflowY !== 'hidden' && overflowY !== 'visible') {
+ const { scrollTop, scrollHeight, clientHeight } = $parent;
+ if (scrollHeight > clientHeight) {
+ canTouchScroll = true;
+ isAtTop = scrollTop <= 3;
+ isAtBottom = scrollTop >= (scrollHeight - clientHeight) - 3;
+ break;
}
}
- const nextParent = $parent.parentNode;
- if (!nextParent || nextParent.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {
- break;
- }
- $parent = /** @type {HTMLElement} */(nextParent);
+ $parent = $parent.parentElement;
}
if (canTouchScroll && ((!isAtTop && !isAtBottom) || (isAtTop && movedY < 0) || (isAtBottom && movedY > 0))) {