summaryrefslogtreecommitdiffstats
path: root/src/modules/core/textable.js
diff options
context:
space:
mode:
authorUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2018-11-06 13:48:05 +0100
committerUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2018-11-06 13:48:05 +0100
commita0b13ebcacfd74b9f521110c7225bb404325bcd3 (patch)
treea07c5cc422645e31d7dfef81ce4e54f03f0945f6 /src/modules/core/textable.js
parent9f2696e8a2cf7e4eebc1cc7e31027fe2070094fa (diff)
downloadsvg.js-a0b13ebcacfd74b9f521110c7225bb404325bcd3.tar.gz
svg.js-a0b13ebcacfd74b9f521110c7225bb404325bcd3.zip
reordered modules, add es6 build
Diffstat (limited to 'src/modules/core/textable.js')
-rw-r--r--src/modules/core/textable.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/modules/core/textable.js b/src/modules/core/textable.js
new file mode 100644
index 0000000..c9a90db
--- /dev/null
+++ b/src/modules/core/textable.js
@@ -0,0 +1,18 @@
+// 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
+}
+
+// FIXME: Does this also work for textpath?
+// Get length of text element
+export function length () {
+ return this.node.getComputedTextLength()
+}