+ },
+ split: function(params) {
+ var parentElement = this.parent(),
+ myIdx = parentElement.childIndex(this),
+ myCanvas = this.canvas,
+ passed = false,
+ succeedingChildren = [],
+ thisElement = this,
+ prefix = this.getText().substr(0, params.offset),
+ suffix = this.getText().substr(params.offset);
+
+ parentElement.children().forEach(function(child) {
+ if(passed)
+ succeedingChildren.push(child);
+ if(child.sameNode(thisElement))
+ passed = true;
+ });
+
+ if(prefix.length > 0)
+ this.setText(prefix);
+ else
+ this.remove();
+
+ var newElement = DocumentNodeElement.create({tag: parentElement.wlxmlTag, klass: parentElement.wlxmlClass}, myCanvas);
+ parentElement.after(newElement);
+
+ if(suffix.length > 0)
+ newElement.append({text: suffix});
+ succeedingChildren.forEach(function(child) {
+ newElement.append(child);
+ });