X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/5c398fccc970cf74b857ea5c191b325564f9893f..88fd67cfb21bf9b51d2d070de059dc4bbbab63dd:/src/smartxml/core.js?ds=inline diff --git a/src/smartxml/core.js b/src/smartxml/core.js index ba612b4..a2d39a6 100644 --- a/src/smartxml/core.js +++ b/src/smartxml/core.js @@ -77,8 +77,9 @@ var documentNodeTransformations = { wrapWith: function(node) { var insertion = this.getNodeInsertion(node); - if(this.parent()) { - this.before(insertion.ofNode); + + if(this.parent() || this.isRoot()) { + this.replaceWith(insertion.ofNode); } insertion.ofNode.append(this); return insertion.ofNode;