From 97b2b3365d24475cbf61b3ad82c879911270f279 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Aleksander=20=C5=81ukasz?= Date: Thu, 23 Jan 2014 14:42:34 +0100 Subject: [PATCH] smartxml: append/prepend shortcuts for text nodes --- src/smartxml/core.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/smartxml/core.js b/src/smartxml/core.js index 4297c1a..65b7852 100644 --- a/src/smartxml/core.js +++ b/src/smartxml/core.js @@ -240,6 +240,21 @@ var textNodeTransformations = { } }), + append: function(node) { + if(node.nodeType === Node.TEXT_NODE) { + this.appendText(node.getText()); + node.detach(); + return this; + } + }, + prepend: function(node) { + if(node.nodeType === Node.TEXT_NODE) { + this.prependText(node.getText()); + node.detach(); + return this; + } + }, + appendText: function(text) { this.nativeNode.data = this.nativeNode.data + text; this.triggerTextChangeEvent(); -- 2.20.1