From d4ca1d1c7dfe664334b9bbfd752f6598102d2c52 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Aleksander=20=C5=81ukasz?= Date: Tue, 19 Nov 2013 16:45:28 +0100 Subject: [PATCH] smartxml: refactoring --- src/smartxml/smartxml.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) 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; }, /** -- 2.20.1