summaryrefslogtreecommitdiffstats
path: root/src/element.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/element.js')
-rw-r--r--src/element.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/element.js b/src/element.js
index bd5d08d..75d77dc 100644
--- a/src/element.js
+++ b/src/element.js
@@ -171,7 +171,7 @@ SVG.Element = SVG.invent({
if(!type) return parent
// loop trough ancestors if type is given
- while(parent.node instanceof SVGElement){
+ while(parent && parent.node instanceof SVGElement){
if(typeof type === 'string' ? parent.matches(type) : parent instanceof type) return parent
parent = SVG.adopt(parent.node.parentNode)
}
@@ -247,7 +247,7 @@ SVG.Element = SVG.invent({
this.node.removeAttribute('svgjs:data')
if(Object.keys(this.dom).length)
- this.node.setAttributeNS(SVG.svgjs, 'svgjs:data', JSON.stringify(this.dom))
+ this.node.setAttribute('svgjs:data', JSON.stringify(this.dom)) // see #428
return this
}