blob: f61f04a368c7479f6e419605d79d2a62e6a0fa3e (
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
32
33
34
35
|
import Tspan from './Tspan.js'
// Create plain text node
export function plain (text) {
// clear if build mode is disabled
if (this._build === false) {
this.clear()
}
// create text node
this.node.appendChild(document.createTextNode(text))
return this
}
// Create a tspan
export function tspan (text) {
var tspan = new Tspan()
// clear if build mode is disabled
if (!this._build) {
this.clear()
}
// add new tspan
this.node.appendChild(tspan.node)
return tspan.text(text)
}
// FIXME: Does this also work for textpath?
// Get length of text element
export function length () {
return this.node.getComputedTextLength()
}
|