Lean-Mean-Drag-and-Drop icon indicating copy to clipboard operation
Lean-Mean-Drag-and-Drop copied to clipboard

Library doesn't work in Internet Explorer

Open Pravin-Parkhi opened this issue 6 years ago • 0 comments

While using demos in Internet Explorer, library throws error Object doesn't support this action. This error caused by below snippet. scope.dispatchEvent(new CustomEvent('lmddbeforestart', {'bubbles': true})).

Reported error is coming because for IE versions >= 9, custom events must be created using document.createEvent() and then initialized using the initCustomEvent method of the previously created event.

So after doing stackoverflow I found we can fix this issue by adding below pollyfill provided by mozila firefox.

(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;
})();

Pravin-Parkhi avatar Oct 05 '18 12:10 Pravin-Parkhi