Added EventListener to vc-Element instead to document
Change-Id: I2321f1b2180067b83a9e0579c13010586192de1b
diff --git a/dev/js/src/vc.js b/dev/js/src/vc.js
index 4bc5e13..fd67863 100644
--- a/dev/js/src/vc.js
+++ b/dev/js/src/vc.js
@@ -329,6 +329,11 @@
// Add panel to display corpus statistic, ...
this.addVcInfPanel();
+ //Adds EventListener for corpus changes
+ this._element.addEventListener('vcChange', function (e) {
+ that.checkStatActive(e.detail);
+ }, false);
+
return this._element;
},
@@ -367,9 +372,10 @@
*/
update : function() {
this._root.update();
- var vcchevent = new CustomEvent('vcChange', {'detail':this});
- document.dispatchEvent(vcchevent);
-
+ if (KorAP.vc){
+ var vcchevent = new CustomEvent('vcChange', {'detail':this});
+ this.element().dispatchEvent(vcchevent);
+ };
return this;
},
/**