Skip to content
Permalink
Browse files

jquery event: Optimization to global unbinding on window unload. Than…

…ks Mike Helgeson.
  • Loading branch information
flesler committed Jul 1, 2008
1 parent cf78e39 commit 112f7b15ae903aa2378f780f79d30a3dbb011cee
Showing with 6 additions and 3 deletions.
  1. +6 −3 src/event.js
@@ -603,6 +603,9 @@ var withinElement = function(event, elem) {
// 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
jQuery(window).bind("unload", function() {
jQuery("*").add(document).unbind();
});
jQuery( window ).bind( 'unload', function(){
for ( var id in jQuery.cache )
// Skip the window
if ( id != 1 && jQuery.cache[ id ].handle )
jQuery.event.remove( jQuery.cache[ id ].handle.elem );
});

0 comments on commit 112f7b1

Please sign in to comment.
You can’t perform that action at this time.