From: Aleksander Ɓukasz Date: Fri, 6 Dec 2013 13:52:02 +0000 (+0100) Subject: smartxml: fix - DocumentNode.getIndex() now handles node being out of document tree X-Git-Url: https://git.mdrn.pl/fnpeditor.git/commitdiff_plain/d3bd4d6524e46d6732f758b2854afeff1c890b2a smartxml: fix - DocumentNode.getIndex() now handles node being out of document tree --- diff --git a/src/smartxml/smartxml.js b/src/smartxml/smartxml.js index 60ed6a0..6f12667 100644 --- a/src/smartxml/smartxml.js +++ b/src/smartxml/smartxml.js @@ -48,6 +48,10 @@ $.extend(DocumentNode.prototype, { }, getPath: function(ancestor) { + if(!(this.document.containsNode(this))) { + return null; + } + var nodePath = [this].concat(this.parents()), toret, idx; ancestor = ancestor || this.document.root;