aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2018-11-13 15:07:10 +0100
committerGitHub <noreply@github.com>2018-11-13 15:07:10 +0100
commitf066d113ee0f50a4d1b795307bd4b2606ea427b3 (patch)
treee32a42435ed7d74c10c385f81b39dc2a8ec83347
parent4f2fd650261d9f34e872e7d20295658124cc5df0 (diff)
parent5fedccf46e545940213fcbadd870e461d61a29af (diff)
downloadsvg.js-f066d113ee0f50a4d1b795307bd4b2606ea427b3.tar.gz
svg.js-f066d113ee0f50a4d1b795307bd4b2606ea427b3.zip
Merge pull request #927 from NorbertB29/fix/node_document_fragment_type
Add node document-fragment type check
-rw-r--r--src/doc.js2
-rw-r--r--src/element.js2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/doc.js b/src/doc.js
index 536630a..1be4607 100644
--- a/src/doc.js
+++ b/src/doc.js
@@ -53,7 +53,7 @@ SVG.Doc = SVG.invent({
}
// custom parent method
, parent: function() {
- if(!this.node.parentNode || this.node.parentNode.nodeName == '#document') return null
+ if(!this.node.parentNode || this.node.parentNode.nodeName == '#document' || this.node.parentNode.nodeName == '#document-fragment') return null
return this.node.parentNode
}
// Fix for possible sub-pixel offset. See:
diff --git a/src/element.js b/src/element.js
index 35b487b..e2f9c47 100644
--- a/src/element.js
+++ b/src/element.js
@@ -178,7 +178,7 @@ SVG.Element = SVG.invent({
// loop trough ancestors if type is given
while(parent && parent.node instanceof window.SVGElement){
if(typeof type === 'string' ? parent.matches(type) : parent instanceof type) return parent
- if(!parent.node.parentNode || parent.node.parentNode.nodeName == '#document') return null // #759, #720
+ if(!parent.node.parentNode || parent.node.parentNode.nodeName == '#document' || parent.node.parentNode.nodeName == '#document-fragment') return null // #759, #720
parent = SVG.adopt(parent.node.parentNode)
}
}