Commit d0782ed7 authored by Ilya Kantor's avatar Ilya Kantor Committed by Dave Methvin

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.
parent c389c2e6
...@@ -72,12 +72,9 @@ jQuery.event = { ...@@ -72,12 +72,9 @@ jQuery.event = {
eventHandle = elemData.handle = function( e ) { eventHandle = elemData.handle = function( e ) {
// Discard the second event of a jQuery.event.trigger() and // Discard the second event of a jQuery.event.trigger() and
// when an event is called after a page has unloaded // when an event is called after a page has unloaded
return typeof jQuery !== strundefined && (!e || jQuery.event.triggered !== e.type) ? return typeof jQuery !== strundefined && jQuery.event.triggered !== e.type ?
jQuery.event.dispatch.apply( eventHandle.elem, arguments ) : jQuery.event.dispatch.apply( elem, arguments ) : undefined;
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 // Handle multiple events separated by a space
...@@ -146,8 +143,6 @@ jQuery.event = { ...@@ -146,8 +143,6 @@ jQuery.event = {
jQuery.event.global[ type ] = true; 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 // Detach an event or set of events from an element
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment