aboutsummaryrefslogtreecommitdiffstats
path: root/src/doc.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/doc.js')
-rw-r--r--src/doc.js18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/doc.js b/src/doc.js
index caf0cc2..6a48a6a 100644
--- a/src/doc.js
+++ b/src/doc.js
@@ -71,10 +71,24 @@ SVG.Doc = SVG.invent({
// Removes the doc from the DOM
, remove: function() {
if(this.parent()) {
- this.parent().removeChild(this.node);
+ this.parent().removeChild(this.node)
}
- return this;
+ 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
}
}