Make VC replaceable via KorAP.vc.fromJson(...)

Change-Id: Ic7de60fd4b67036e52467b8c0c99b59d504a240b
diff --git a/dev/js/src/vc.js b/dev/js/src/vc.js
index 5d1ccf0..fd22a97 100644
--- a/dev/js/src/vc.js
+++ b/dev/js/src/vc.js
@@ -178,19 +178,22 @@
      * corpus document
      */
     fromJson : function(json) {
+
+      let obj;
+      
       if (json !== undefined) {
         // Parse root document
         if (json['@type'] == 'koral:doc') {
-          this._root = docClass.create(this, json);
+          obj = docClass.create(this, json);
         }
         // parse root group
         else if (json['@type'] == 'koral:docGroup') {
-          this._root = docGroupClass.create(this, json);
+          obj = docGroupClass.create(this, json);
         }
 
         // parse root reference
         else if (json['@type'] == 'koral:docGroupRef') {
-          this._root = docGroupRefClass.create(this, json);
+          obj = docGroupRefClass.create(this, json);
         }
         
         // Unknown collection type
@@ -202,12 +205,12 @@
 
       else {
         // Add unspecified object
-        this._root = unspecDocClass.create(this);
+        obj = unspecDocClass.create(this);
       };
 
       // Init element and update
-      this.update();
-
+      this.root(obj);   
+ 
       return this;
     },
 
diff --git a/dev/js/src/vc/docgroup.js b/dev/js/src/vc/docgroup.js
index c73a325..3a22034 100644
--- a/dev/js/src/vc/docgroup.js
+++ b/dev/js/src/vc/docgroup.js
@@ -210,8 +210,10 @@
 
       group.appendChild(op.element());
 
-      var vcchevent = new CustomEvent('vcChange', {'detail':this});
-      KorAP.vc.element().dispatchEvent(vcchevent);
+      if (KorAP.vc) {
+        var vcchevent = new CustomEvent('vcChange', {'detail':this});
+        KorAP.vc.element().dispatchEvent(vcchevent);
+      };
       
       return this;
     },