blob: 6d253a8e809cb9fe8a9e4c88cea9ad9e664e63e4 (
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
25
26
27
28
|
/* global createElement */
SVG.HtmlNode = SVG.invent({
create: function (element) {
this.node = element
},
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])
}
return this
},
put: function (element, i) {
this.add(element, i)
return element
}
}
})
|