summaryrefslogtreecommitdiffstats
path: root/src/HtmlNode.js
blob: e7dae10c44ccc9e639897dc9a08a435b920a67bd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/* global createElement */

SVG.HtmlNode = SVG.invent({
  create: function (element) {
    this.node = element
  },

  extend: {
    add: function (element, i) {
      element = createElement(element)

      if (element.node !== this.node.children[i]) {
        this.node.insertBefore(element.node, this.node.children[i] || null)
      }

      return this
    },

    put: function (element, i) {
      this.add(element, i)
      return element
    }
  }
})