Side navigation
#2139 closed bug (invalid)
Opened January 09, 2008 07:12PM UTC
Closed January 14, 2008 07:03PM UTC
Last modified March 15, 2012 09:29AM UTC
$(window).onunload
Reported by: | qutoz | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | 1.2.2 |
Component: | core | Version: | 1.2.1 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
Hi,
I'm trying to use the unload event handler with jQuery, but it's not working.
There's no error, but it doesn't fire up.
This is my code:
$(window).unload(function(){ alert("foo"); } )
Attachments (1)
Change History (2)
Changed January 09, 2008 09:25PM UTC by comment:1
Changed January 14, 2008 07:03PM UTC by comment:2
resolution: | → invalid |
---|---|
status: | new → closed |
This is correct - or, at least, this is how it behaved in jQuery 1.0.* - so the API is compatible. It's obvious that it's a problem, which is why the API was changed in the first place :-)
After some investigation, it turns out that this is a bug in compat-1.0 compatibility plugin.
As it's trying to support the old "un"+event shortcuts, and by doing that it was overriding the unload event when it creates the shortcut for the load event ("un"+"load").
Patch attached above, which fixes this problem. But it would mean that the "un"+"load" shortcut is not available.