wlxml: Document's root is always a context root
authorAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Thu, 26 Jun 2014 07:31:08 +0000 (09:31 +0200)
committerAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Thu, 14 Aug 2014 14:26:12 +0000 (16:26 +0200)
src/wlxml/wlxml.js

index df93b3e..262004c 100644 (file)
@@ -33,6 +33,9 @@ var WLXMLDocumentNodeMethods =  {
     isContextRoot: function() {
         var me = this.nodeType === Node.ELEMENT_NODE ? [this] : [],
             toret = false;
+        if(!this.parent()) {
+            return true;
+        }
         me.concat(this.parents()).some(function(node) {
             if(_.isFunction(node.object.isContextRoot) && node.object.isContextRoot(this)) {
                 toret = true;