X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/a0ea5d8b3f8045f428a032df8cacde0ed54172ab..cb448b7a76c90d02af296fca3830b056f0639a1e:/src/smartxml/smartxml.js diff --git a/src/smartxml/smartxml.js b/src/smartxml/smartxml.js index 8039916..b673865 100644 --- a/src/smartxml/smartxml.js +++ b/src/smartxml/smartxml.js @@ -162,10 +162,14 @@ $.extend(DocumentNode.prototype, { }, getIndex: function() { + var parent; + if(this.isRoot()) { return 0; } - return this.parent().indexOf(this); + + parent = this.parent(); + return parent ? parent.indexOf(this) : undefined; }, getNearestElementNode: function() {