aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIlya Kantor <iliakan@gmail.com>2013-10-15 17:09:55 +0400
committerDave Methvin <dave.methvin@gmail.com>2013-11-14 14:46:47 -0500
commitd0782ed7e81a181f0541e1ce7c8cba0825a80299 (patch)
tree4742a40dc4b68292d391498eec80f2424ca8f40e
parentc389c2e6ba698e95c683ad113d728e757a4da29a (diff)
downloadjquery-d0782ed7e81a181f0541e1ce7c8cba0825a80299.tar.gz
jquery-d0782ed7e81a181f0541e1ce7c8cba0825a80299.zip
Event: Fix #14544. Remove elem from event handle, close gh-1400.
This also reduces memory leaks if the element is removed without cleaning events (e.g with native DOM operations). Not pickable into the 1.x branch because oldIE still needs this.
-rw-r--r--src/event.js9
1 files changed, 2 insertions, 7 deletions
diff --git a/src/event.js b/src/event.js
index fc924ec36..5ca6d2e96 100644
--- a/src/event.js
+++ b/src/event.js
@@ -72,12 +72,9 @@ jQuery.event = {
eventHandle = elemData.handle = function( e ) {
// Discard the second event of a jQuery.event.trigger() and
// when an event is called after a page has unloaded
- return typeof jQuery !== strundefined && (!e || jQuery.event.triggered !== e.type) ?
- jQuery.event.dispatch.apply( eventHandle.elem, arguments ) :
- undefined;
+ return typeof jQuery !== strundefined && jQuery.event.triggered !== e.type ?
+ jQuery.event.dispatch.apply( elem, arguments ) : undefined;
};
- // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events
- eventHandle.elem = elem;
}
// Handle multiple events separated by a space
@@ -146,8 +143,6 @@ jQuery.event = {
jQuery.event.global[ type ] = true;
}
- // Nullify elem to prevent memory leaks in IE
- elem = null;
},
// Detach an event or set of events from an element