Event Constructor throws Object doesn’t support this action error in internet explorer

To use Event API on internet explorer, you will have to add the following polyfill when your application loads initially.

(function () {

  if ( typeof window.CustomEvent === "function" ) return false;

  function CustomEvent ( event, params ) {
    params = params || { bubbles: false, cancelable: false, detail: undefined };
    var evt = document.createEvent( 'CustomEvent' );
    evt.initCustomEvent( event, params.bubbles, params.cancelable, params.detail );
    return evt;

  CustomEvent.prototype = window.Event.prototype;

  window.CustomEvent = CustomEvent;

Once you add above polyfill, in your app code instead of Event use CustomEvent. For example,

// var event = new Event("tooltip_shown", {'bubbles': true});
var event = new CustomEvent("tooltip_shown", {'bubbles': true});


You may also like...