smartxml: fix - DocumentNode.getIndex() now handles node being out of document tree
[fnpeditor.git] / src / smartxml / smartxml.js
index 60ed6a0..6f12667 100644 (file)
@@ -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;