webapis-shadydom.js 1.0 KB

12345678910111213141516171819202122232425
  1. 'use strict';
  2. /**
  3. * @license Angular v<unknown>
  4. * (c) 2010-2022 Google LLC. https://angular.io/
  5. * License: MIT
  6. */
  7. Zone.__load_patch('shadydom', (global, Zone, api) => {
  8. // https://github.com/angular/zone.js/issues/782
  9. // in web components, shadydom will patch addEventListener/removeEventListener of
  10. // Node.prototype and WindowPrototype, this will have conflict with zone.js
  11. // so zone.js need to patch them again.
  12. const HTMLSlotElement = global.HTMLSlotElement;
  13. const prototypes = [
  14. Object.getPrototypeOf(window), Node.prototype, Text.prototype, Element.prototype,
  15. HTMLElement.prototype, HTMLSlotElement && HTMLSlotElement.prototype, DocumentFragment.prototype,
  16. Document.prototype
  17. ];
  18. prototypes.forEach(function (proto) {
  19. if (proto && proto.hasOwnProperty('addEventListener')) {
  20. proto[Zone.__symbol__('addEventListener')] = null;
  21. proto[Zone.__symbol__('removeEventListener')] = null;
  22. api.patchEventTarget(global, api, [proto]);
  23. }
  24. });
  25. });