aboutsummaryrefslogtreecommitdiffstats
path: root/src/doc.js
diff options
context:
space:
mode:
authorUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2017-03-29 16:10:36 +0200
committerUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2017-03-29 16:10:36 +0200
commitbb38273b6a2efd3795480cc36fa0ad0d67b73997 (patch)
tree146cc8f4fddb6d1203126546e0610077b42f4588 /src/doc.js
parentebf7436261c8fc3197a48dc6b21dff9edd9271e3 (diff)
downloadsvg.js-bb38273b6a2efd3795480cc36fa0ad0d67b73997.tar.gz
svg.js-bb38273b6a2efd3795480cc36fa0ad0d67b73997.zip
clear does not remove parser anymore
make test work in svg documents
Diffstat (limited to 'src/doc.js')
-rw-r--r--src/doc.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/doc.js b/src/doc.js
index caf0cc2..c6da348 100644
--- a/src/doc.js
+++ b/src/doc.js
@@ -76,6 +76,20 @@ SVG.Doc = SVG.invent({
return this;
}
+ , clear: function() {
+ // remove children
+ while(this.node.hasChildNodes())
+ this.node.removeChild(this.node.lastChild)
+
+ // remove defs reference
+ delete this._defs
+
+ // add back parser
+ if(!SVG.parser.draw.parentNode)
+ this.node.appendChild(SVG.parser.draw)
+
+ return this
+ }
}
})