diff options
Diffstat (limited to 'src/elements/Dom.js')
-rw-r--r-- | src/elements/Dom.js | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/elements/Dom.js b/src/elements/Dom.js index ff33d46..45a41ca 100644 --- a/src/elements/Dom.js +++ b/src/elements/Dom.js @@ -156,8 +156,9 @@ export default class Dom extends EventTarget { if (!type) return parent // loop trough ancestors if type is given - while (parent && parent.node instanceof globals.window.SVGElement) { // FIXME: That shouldnt be neccessary + while (parent) { // FIXME: That shouldnt be neccessary if (typeof type === 'string' ? parent.matches(type) : parent instanceof type) return parent + if (!parent.node.parentNode || parent.node.parentNode.nodeName === '#document' || parent.node.parentNode.nodeName === '#document-fragment') return null // #759, #720 parent = adopt(parent.node.parentNode) } } |