Skip to content
Permalink
Browse files
fix for #5198, event memory leak limited to IE only via conditional c…
…ompilation
  • Loading branch information
brandonaaron committed Sep 14, 2009
1 parent 4a3c4c8 commit f3474c00cd6d9e5fd61b6ef1562003e9986ad67d
Showing 1 changed file with 2 additions and 2 deletions.
@@ -776,11 +776,10 @@ jQuery.each( ("blur,focus,load,resize,scroll,unload,click,dblclick," +
});

// Prevent memory leaks in IE
// And prevent errors on refresh with events like mouseover in other browsers
// Window isn't included so as not to unbind existing unload events
// More info:
// - http://isaacschlueter.com/2006/10/msie-memory-leaks/
// - https://bugzilla.mozilla.org/show_bug.cgi?id=252542
/*@cc_on
jQuery( window ).bind( 'unload', function() {
for ( var id in jQuery.cache ) {
// Skip the window
@@ -789,3 +788,4 @@ jQuery( window ).bind( 'unload', function() {
}
}
});
@*/

4 comments on commit f3474c0

@steida
Copy link

@steida steida commented on f3474c0 May 30, 2010

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And that's how fairytale story about feature over browser detection ends :-)

@jdalton
Copy link
Member

@jdalton jdalton commented on f3474c0 May 30, 2010

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't be silly. That is old code. They have since replaced it with feature detection for IE's DOM API and test for the Firefox bug in a different way. By reworking the event system a bit they could make the event system not rely on unload for IE as well.

@steida
Copy link

@steida steida commented on f3474c0 May 31, 2010

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really? I suppose unload event is necessary and feature undetectable as well.

@jdalton
Copy link
Member

@jdalton jdalton commented on f3474c0 Jun 1, 2010

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unload is not necessary if the event system is tweaked a bit. Most libs use the unload event to cleanup memory leaks in IE6/7. Absent tweaking the event system to remove the need for unload they use DOM API inference to detect IE's non-standard event and use the unload event for it.

Please sign in to comment.