smartxml: fixing detachment of the document root
[fnpeditor.git] / src / smartxml / core.js
index ec2c643..ae445e0 100644 (file)
@@ -32,6 +32,10 @@ var documentNodeTransformations = {
         this._$.detach();
         if(existed) {
             this.triggerChangeEvent('nodeDetached', {parent: parent});
+            if(!parent) {
+                // This was the root of the document
+                this.document._defineDocumentProperties(null);
+            }
         }
         return this;
     },