CoreFiles by mySites.guru
customevent.es633 lines, 835 bytes, from Joomla_4.0.0-beta3-Beta-Full_Package.zip
Raw History Compare with 4.0.0-beta2
md5
ff2e63c4981080309534c57377d18c73
sha1
d238a2dc3f5db09df63c7c741d87cbebf2f8d3e3
sha256
c8829b28da70f3728e92613e8f6399f135c53b55c9385b0da12ceea9571d16d8
/**
 * @copyright  Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved.
 * @license    GNU General Public License version 2 or later; see LICENSE.txt
 */

// eslint-disable max-len
/**
 * Patch Custom Events
 * https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent
 */
(() => {
  if (typeof window.CustomEvent === 'function') {
    return false;
  }

  const CustomEvent = (event, params) => {
    const evt = document.createEvent('CustomEvent');
    const newParams = params
      || {
        bubbles: false,
        cancelable: false,
        detail: undefined,
      };

    evt.initCustomEvent(event, newParams.bubbles, newParams.cancelable, newParams.detail);
    return evt;
  };

  CustomEvent.prototype = window.Event.prototype;

  window.CustomEvent = CustomEvent;
  return true;
})();

The same content is in 5 releases, Joomla 4.0.0-beta to 4.0.0-beta5. See them all, or every version of this file.