Side navigation
#2287 closed bug (invalid)
Opened February 06, 2008 08:56PM UTC
Closed March 31, 2011 07:56PM UTC
Remove unnecessary sourcing of events from global window
Reported by: | diego | Owned by: | |
---|---|---|---|
Priority: | low | Milestone: | |
Component: | event | Version: | 1.2.2 |
Keywords: | IE global event | Cc: | |
Blocked by: | Blocking: |
Description
This is only needed in multi-document environments like iframes, new window.open or created documents, where the window, source of the event, may be different each time.
For Internet Explorer jQuery uses attachEvent, so if attachEvent is really able to always pass a correctly sourced event we shouldn't need this (current jquery):
event = jQuery.event.fix( event || window.event || {} );
but this instead:
event = jQuery.event.fix( event );
If instead there are known cases where event may be "null" or "undefined" then the above line should be fixed as follow:
event = jQuery.event.fix( event || ((this.ownerDocument || this.document || this).parentWindow || window).event );
This is the related discussion on the "jquery-dev" group:
http://groups.google.com/group/jquery-dev/browse_thread/thread/b87638ba86f03fe5
Attachments (2)
Change History (4)
Changed February 09, 2008 12:13PM UTC by comment:1
Changed November 13, 2010 06:48PM UTC by comment:2
Can someone provide a test case? It seems plausible that the parent's window.event is the wrong one for an event fired from a child iframe, but i was unable to craft a test case that showed it failing. However, I'm leaving this ticket open and attaching my (working in IE8) test case as a starting point; this problem could be related to some of the other open iframe tickets.
Changed November 15, 2010 12:50AM UTC by comment:3
milestone: | 1.2.3 → 1.5 |
---|---|
priority: | minor → low |
status: | new → open |
I'm guessing your recent additions mean that we should open this one back up for a newer version. Acting.
Changed March 31, 2011 07:56PM UTC by comment:4
resolution: | → invalid |
---|---|
status: | open → closed |
We never got a failing test case.
An omission in the above, I forgot to include the empty event object for custom events.
The suggested fixes should be changed as follow instead.
This will work correctly, even for custom events:
In cases where the event object may be "null" or "undefined", probably in the case of triggered DOM0 events, we would have to use a longer conditional reference instead:
This bug will only show if DOM0 events and/or iframes are used.
I retested and the bug will never show in a single document environment and will never fail when DOM2 events or IE attachEvent are used to setup the chains of event listeners.
Diego