
committed by
Miško Hevery

parent
a86850e3f2
commit
35a025fbca
@ -10,15 +10,17 @@ Zone.__load_patch('shadydom', (global: any, Zone: ZoneType, api: _ZonePrivate) =
|
||||
// in web components, shadydom will patch addEventListener/removeEventListener of
|
||||
// Node.prototype and WindowPrototype, this will have conflict with zone.js
|
||||
// so zone.js need to patch them again.
|
||||
const windowPrototype = Object.getPrototypeOf(window);
|
||||
if (windowPrototype && windowPrototype.hasOwnProperty('addEventListener')) {
|
||||
(windowPrototype as any)[Zone.__symbol__('addEventListener')] = null;
|
||||
(windowPrototype as any)[Zone.__symbol__('removeEventListener')] = null;
|
||||
api.patchEventTarget(global, [windowPrototype]);
|
||||
}
|
||||
if (Node.prototype.hasOwnProperty('addEventListener')) {
|
||||
(Node.prototype as any)[Zone.__symbol__('addEventListener')] = null;
|
||||
(Node.prototype as any)[Zone.__symbol__('removeEventListener')] = null;
|
||||
api.patchEventTarget(global, [Node.prototype]);
|
||||
}
|
||||
const HTMLSlotElement = global.HTMLSlotElement;
|
||||
const prototypes = [
|
||||
Object.getPrototypeOf(window), Node.prototype, Text.prototype, Element.prototype,
|
||||
HTMLElement.prototype, HTMLSlotElement && HTMLSlotElement.prototype, DocumentFragment.prototype,
|
||||
Document.prototype
|
||||
];
|
||||
prototypes.forEach(function(proto) {
|
||||
if (proto && proto.hasOwnProperty('addEventListener')) {
|
||||
proto[Zone.__symbol__('addEventListener')] = null;
|
||||
proto[Zone.__symbol__('removeEventListener')] = null;
|
||||
api.patchEventTarget(global, [proto]);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user