Commit b986c49e authored by catch's avatar catch
Browse files

Issue #3239507 by hooroomoo, bnjmnm: Add CustomEvent polyfill to support IE11

parent 1ac9aaff
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -186,6 +186,11 @@ drupal.collapse:
    - core/drupal.form
    - core/once

drupal.customevent:
  version: VERSION
  js:
    misc/polyfills/customevent.js: { weight: -20 }

drupal.date:
  version: VERSION
  js:
+1 −0
Original line number Diff line number Diff line
@@ -320,6 +320,7 @@ curle
curlopt
currenttime
currentuser
customevent
customly
customrequest
cweagans
+30 −0
Original line number Diff line number Diff line
/**
 * @file
 * Provides a polyfill for CustomEvent.
 *
 * This is needed for Internet Explorer 11.
 *
 * This has been copied from MDN Web Docs code samples. Code samples in the MDN
 * Web Docs are licensed under CC0.
 *
 * @see https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent#Polyfill
 * @see https://developer.mozilla.org/en-US/docs/MDN/About#Code_samples_and_snippets
 */
// eslint-disable-next-line func-names
(function () {
  if (typeof window.CustomEvent === 'function') return false;

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

  window.CustomEvent = CustomEvent;
})();
+23 −0
Original line number Diff line number Diff line
/**
* DO NOT EDIT THIS FILE.
* See the following change record for more information,
* https://www.drupal.org/node/2815083
* @preserve
**/

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

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

  window.CustomEvent = CustomEvent;
})();
 No newline at end of file