aboutsummaryrefslogtreecommitdiffstats
path: root/src/jqLite.js
diff options
context:
space:
mode:
authorVojta Jina2012-02-05 00:09:02 -0800
committerVojta Jina2012-02-05 00:09:02 -0800
commit3173d8603db4ae1c2373e13a7a490988126bb1e7 (patch)
treea0103fc330fe33d5183a15348c52775649dc1bf6 /src/jqLite.js
parent6c4f1391bc10ebfd76bb39d3cb7f7b3b3bff4dd5 (diff)
downloadangular.js-3173d8603db4ae1c2373e13a7a490988126bb1e7.tar.bz2
fix(jqLite): fix memory leaking in IE8 (remove monkey patched methods on Event)
These methods cause IE8 holds the whole jqLite in the memory, even when page is reloaded. jqLite's cache keeps element's data (event handlers, attached scopes, injector, etc…), so almost all used memory is never released in IE8. jQuery creates its own Event object (wrapper around native Event) instead.
Diffstat (limited to 'src/jqLite.js')
-rw-r--r--src/jqLite.js7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/jqLite.js b/src/jqLite.js
index 73420d74..751d9eb1 100644
--- a/src/jqLite.js
+++ b/src/jqLite.js
@@ -514,6 +514,13 @@ forEach({
forEach(eventHandler.fns, function(fn){
fn.call(element, event);
});
+
+ // Remove monkey-patched methods (IE),
+ // as they would cause memory leaks in IE8.
+ // It shouldn't affect normal browsers, as their native methods are defined on prototype.
+ delete event.preventDefault
+ delete event.stopPropagation
+ delete event.isDefaultPrevented
};
eventHandler.fns = [];
addEventListenerFn(element, type, eventHandler);