From d3bd4d6524e46d6732f758b2854afeff1c890b2a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Aleksander=20=C5=81ukasz?= Date: Fri, 6 Dec 2013 14:52:02 +0100 Subject: [PATCH] smartxml: fix - DocumentNode.getIndex() now handles node being out of document tree --- src/smartxml/smartxml.js | 4 ++++ 1 file changed, 4 insertions(+) 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; -- 2.20.1