diff options
Diffstat (limited to 'src/HtmlNode.js')
-rw-r--r-- | src/HtmlNode.js | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/HtmlNode.js b/src/HtmlNode.js index 38309e3..37a231c 100644 --- a/src/HtmlNode.js +++ b/src/HtmlNode.js @@ -1,25 +1,24 @@ SVG.HtmlNode = SVG.invent({ - create: function(element) { + create: function (element) { this.node = element - } + }, -, extend: { - add: function(element, i) { + extend: { + add: function (element, i) { element = createElement(element) - if(element instanceof SVG.Nested) { + 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]) + 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]) + } return this - } + }, - , put: function(element, i) { + put: function (element, i) { this.add(element, i) return element } |