summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2015-02-22 16:25:37 +0100
committerUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2015-02-22 16:25:37 +0100
commite5b321e1c49928d5e7fceeeedec7fde91aa5e0f0 (patch)
treec1761e94f8cbdbf08388b07588c03c85b3189a1a /src
parent095b474e110f7ed7f5920ca297607b58ed351128 (diff)
downloadsvg.js-e5b321e1c49928d5e7fceeeedec7fde91aa5e0f0.tar.gz
svg.js-e5b321e1c49928d5e7fceeeedec7fde91aa5e0f0.zip
Fixes #326
drawing.remove() now calls destroy() to remove the doc from the DOM
Diffstat (limited to 'src')
-rwxr-xr-xsrc/doc.js8
-rwxr-xr-xsrc/element.js2
2 files changed, 9 insertions, 1 deletions
diff --git a/src/doc.js b/src/doc.js
index a10bffe..a2c756b 100755
--- a/src/doc.js
+++ b/src/doc.js
@@ -78,6 +78,14 @@ SVG.Doc = SVG.invent({
return this
}
+
+ // Removes the doc from the DOM
+ , destroy: function() {
+ this.parent.removeChild(this.node);
+ this.parent = null;
+
+ return this;
+ }
}
})
diff --git a/src/element.js b/src/element.js
index 8c4166d..438f5a9 100755
--- a/src/element.js
+++ b/src/element.js
@@ -101,7 +101,7 @@ SVG.Element = SVG.invent({
// Remove element
, remove: function() {
if (this.parent)
- this.parent.removeElement(this)
+ this.doc() === this ? this.destroy() : this.parent.removeElement(this)
return this
}