Nodejs HTML Element Event Trigger triggerEvent(eventName)

Here you can find the source of triggerEvent(eventName)

Method Source Code

Element.prototype.triggerEvent = function(eventName){
   if (document.createEvent)
   {// w w w  .ja v  a 2  s . com
      var evt = document.createEvent('HTMLEvents');
      evt.initEvent(eventName, true, true);

      return this.dispatchEvent(evt);
   }
   if (this.fireEvent)
      return this.fireEvent('on' + eventName);
}