Side navigation
#1148 closed bug (fixed)
Opened April 28, 2007 10:10AM UTC
Closed April 30, 2007 03:19AM UTC
Last modified June 21, 2007 05:04AM UTC
Window load and resize events fail in Safari
Reported by: | eric | Owned by: | |
---|---|---|---|
Priority: | critical | Milestone: | 1.1.3 |
Component: | event | Version: | 1.1.2 |
Keywords: | safari, event | Cc: | |
Blocked by: | Blocking: |
Description
Calls to $(window).load and $(window).resize fail in Safari version 2.0.(412). An error in event.fix seems to be the cause.
Attachments (0)
Change History (4)
Changed April 28, 2007 08:01PM UTC by comment:1
Changed April 30, 2007 02:09AM UTC by comment:2
need: | Review → Test Case |
---|---|
priority: | critical → major |
resolution: | → worksforme |
status: | new → closed |
This works for me. http://brandon.jquery.com/testing/1148/test.html
Please feel free to reopen with a test case.
Changed April 30, 2007 02:20AM UTC by comment:3
priority: | major → critical |
---|---|
resolution: | worksforme |
status: | closed → reopened |
Never mind. I didn't wrap the event handlers in document.ready. :) Reopened and checking into fix right now.
Changed April 30, 2007 03:19AM UTC by comment:4
resolution: | → fixed |
---|---|
status: | reopened → closed |
Okay ... round and round we go. It looks like document.ready and load are firing at the same time for my test page in Safari and that is why it was not working for me ... not because it was throwing the error you describe. The resize event works just fine. I'm unable to reproduce this bug.
This might have been resolved with the move to DOM Level 2 event handlers. Please feel free to reopen if you can reproduce with the latest from SVN.
It seems that for window events in safari event.target is null. I see this happening in version 2.0.4. (maybe a safari bug). Firefox shows the event target as the document object.
The problem seems to be event.fix. The conditional on line [[http://dev.jquery.com/browser/trunk/jquery/src/event/event.js#L196 196]] assumes an event.target:
this fixes the problem for me:
This avoids the error and allows Safari to continue executing the event code but maybe it would be better to assign the document as a default target for events with a null target. The null target thing strikes me as the sort of thing that will cause more bugs at some point.