summaryrefslogtreecommitdiffstats
path: root/src/modules/core/textable.js
diff options
context:
space:
mode:
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()
+}