webapis-shadydom.umd.js 1.5 KB

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