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

Commit

Permalink
fix(addEventListener patch): ignore FunctionWrapper for IE11 & Edge d…
Browse files Browse the repository at this point in the history
…ev tools
  • Loading branch information
marclaval authored and vicb committed Aug 17, 2015
1 parent 2cc59d8 commit 3b0ca3f
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,22 +92,24 @@ function patchEventTargetMethods(obj) {
var addDelegate = obj.addEventListener;
obj.addEventListener = function (eventName, handler) {
var fn;

if (handler.handleEvent) {
// Have to pass in 'handler' reference as an argument here, otherwise it gets clobbered in
// IE9 by the arguments[1] assignment at end of this function.
fn = (function(handler) {
return function() {
handler.handleEvent.apply(handler, arguments);
};
})(handler);
} else {
fn = handler;
}
//Ignore special listeners of IE11 & Edge dev tools, see https://github.com/angular/zone.js/issues/150
if (handler.toString() !== "[object FunctionWrapper]") {
if (handler.handleEvent) {
// Have to pass in 'handler' reference as an argument here, otherwise it gets clobbered in
// IE9 by the arguments[1] assignment at end of this function.
fn = (function(handler) {
return function() {
handler.handleEvent.apply(handler, arguments);
};
})(handler);
} else {
fn = handler;
}

handler._fn = fn;
handler._bound = handler._bound || {};
arguments[1] = handler._bound[eventName] = zone.bind(fn);
handler._fn = fn;
handler._bound = handler._bound || {};
arguments[1] = handler._bound[eventName] = zone.bind(fn);
}
return addDelegate.apply(this, arguments);
};

Expand Down

0 comments on commit 3b0ca3f

Please sign in to comment.