blob: 7b3be98fcf2db721f3267c67d0168fb0f45a2367 (
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
29
30
31
|
import { nodeOrNew } from './tools.js'
import { register } from './adopter.js'
import Container from './Container.js'
import { registerMethods } from './methods.js'
export default class Bare extends Container {
constructor (node) {
super(nodeOrNew(node, typeof node === 'string' ? null : node), Bare)
}
words (text) {
// remove contents
while (this.node.hasChildNodes()) {
this.node.removeChild(this.node.lastChild)
}
// create text node
this.node.appendChild(document.createTextNode(text))
return this
}
}
register(Bare)
registerMethods('Container', {
// Create an element that is not described by SVG.js
element (node, inherit) {
return this.put(new Bare(node, inherit))
}
})
|