X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/e72654c4d22af93a05a8af98ab58cc44b152c6e7..59b807cd7a781fad54e66f1e59b09369d91d53b4:/src/smartxml/smartxml.js diff --git a/src/smartxml/smartxml.js b/src/smartxml/smartxml.js index b150cde..e484070 100644 --- a/src/smartxml/smartxml.js +++ b/src/smartxml/smartxml.js @@ -136,6 +136,9 @@ $.extend(DocumentNode.prototype, { }, getIndex: function() { + if(this.isRoot()) { + return 0; + } return this.parent().indexOf(this); } }); @@ -255,6 +258,7 @@ $.extend(ElementNode.prototype, { myContents = this.contents(), myIdx = parent.indexOf(this); + if(myContents.length === 0) { return this.detach(); }