Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

Commit 3b0ca3f

Browse files
marclavalvicb
authored andcommitted
fix(addEventListener patch): ignore FunctionWrapper for IE11 & Edge dev tools
1 parent 2cc59d8 commit 3b0ca3f

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

Diff for: lib/utils.js

+17-15
Original file line numberDiff line numberDiff line change
@@ -92,22 +92,24 @@ function patchEventTargetMethods(obj) {
9292
var addDelegate = obj.addEventListener;
9393
obj.addEventListener = function (eventName, handler) {
9494
var fn;
95-
96-
if (handler.handleEvent) {
97-
// Have to pass in 'handler' reference as an argument here, otherwise it gets clobbered in
98-
// IE9 by the arguments[1] assignment at end of this function.
99-
fn = (function(handler) {
100-
return function() {
101-
handler.handleEvent.apply(handler, arguments);
102-
};
103-
})(handler);
104-
} else {
105-
fn = handler;
106-
}
95+
//Ignore special listeners of IE11 & Edge dev tools, see https://github.com/angular/zone.js/issues/150
96+
if (handler.toString() !== "[object FunctionWrapper]") {
97+
if (handler.handleEvent) {
98+
// Have to pass in 'handler' reference as an argument here, otherwise it gets clobbered in
99+
// IE9 by the arguments[1] assignment at end of this function.
100+
fn = (function(handler) {
101+
return function() {
102+
handler.handleEvent.apply(handler, arguments);
103+
};
104+
})(handler);
105+
} else {
106+
fn = handler;
107+
}
107108

108-
handler._fn = fn;
109-
handler._bound = handler._bound || {};
110-
arguments[1] = handler._bound[eventName] = zone.bind(fn);
109+
handler._fn = fn;
110+
handler._bound = handler._bound || {};
111+
arguments[1] = handler._bound[eventName] = zone.bind(fn);
112+
}
111113
return addDelegate.apply(this, arguments);
112114
};
113115

0 commit comments

Comments
 (0)