From 75c3893a7c7af76f9bb1fe9be72e03b99d17a1e0 Mon Sep 17 00:00:00 2001 From: Ulrich-Matthias Schäfer Date: Thu, 1 Mar 2018 12:42:16 +0100 Subject: fixed all that errors which come along when removing an object. Fixed tests, too and added isRoot test --- src/HtmlNode.js | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'src/HtmlNode.js') 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 -- cgit v1.2.3