summaryrefslogtreecommitdiffstats
path: root/src/HtmlNode.js
diff options
context:
space:
mode:
authorUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2018-03-01 12:42:16 +0100
committerUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2018-03-01 12:42:16 +0100
commit75c3893a7c7af76f9bb1fe9be72e03b99d17a1e0 (patch)
tree16cec0ea31f80b2e48517e787097ab1d9d799ce7 /src/HtmlNode.js
parent981c1fb154e3999f91dd9c1eff97726d689240ff (diff)
downloadsvg.js-75c3893a7c7af76f9bb1fe9be72e03b99d17a1e0.tar.gz
svg.js-75c3893a7c7af76f9bb1fe9be72e03b99d17a1e0.zip
fixed all that errors which come along when removing an object. Fixed tests, too and added isRoot test
Diffstat (limited to 'src/HtmlNode.js')
-rw-r--r--src/HtmlNode.js10
1 files changed, 2 insertions, 8 deletions
diff --git a/src/HtmlNode.js b/src/HtmlNode.js
index 30cb4cf..e7dae10 100644
--- a/src/HtmlNode.js
+++ b/src/HtmlNode.js
@@ -8,15 +8,9 @@ SVG.HtmlNode = SVG.invent({
extend: {
add: function (element, i) {
element = createElement(element)
- if (element instanceof SVG.Nested) {
- element = new SVG.Doc(element.node)
- element.setData(JSON.parse(element.node.getAttribute('svgjs:data')) || {})
- }
- if (i === null) {
- this.node.appendChild(element.node)
- } else if (element.node !== this.node.children[i]) {
- this.node.insertBefore(element.node, this.node.children[i])
+ if (element.node !== this.node.children[i]) {
+ this.node.insertBefore(element.node, this.node.children[i] || null)
}
return this