From: Aleksander Ɓukasz Date: Tue, 19 Nov 2013 15:45:28 +0000 (+0100) Subject: smartxml: refactoring X-Git-Url: https://git.mdrn.pl/fnpeditor.git/commitdiff_plain/d4ca1d1c7dfe664334b9bbfd752f6598102d2c52?ds=inline smartxml: refactoring --- diff --git a/src/smartxml/smartxml.js b/src/smartxml/smartxml.js index e484070..05583c5 100644 --- a/src/smartxml/smartxml.js +++ b/src/smartxml/smartxml.js @@ -91,13 +91,12 @@ $.extend(DocumentNode.prototype, { }), wrapWith: function(node) { - node = node instanceof ElementNode ? node : this.document.createElementNode(node); - + var insertion = this.getNodeInsertion(node); if(this.parent()) { - this.before(node); + this.before(insertion.ofNode); } - node.append(this); - return node; + insertion.ofNode.append(this); + return insertion.ofNode; }, /**