git.asbjorn.biz
/
jquery.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
cf78e39
)
jquery event: Optimization to global unbinding on window unload. Thanks Mike Helgeson.
author
Ariel Flesler
<aflesler@gmail.com>
Tue, 1 Jul 2008 02:50:38 +0000
(
02:50
+0000)
committer
Ariel Flesler
<aflesler@gmail.com>
Tue, 1 Jul 2008 02:50:38 +0000
(
02:50
+0000)
src/event.js
patch
|
blob
|
history
diff --git
a/src/event.js
b/src/event.js
index
b93364b
..
9947780
100644
(file)
--- a/
src/event.js
+++ b/
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
// 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 );
+});