Side navigation
#4164 closed bug (invalid)
Opened February 16, 2009 12:52PM UTC
Closed June 16, 2009 10:33PM UTC
Last modified March 14, 2012 03:09PM UTC
IE doesn't get an event.which property when fixing click events
Reported by: | larholm | Owned by: | brandon |
---|---|---|---|
Priority: | major | Milestone: | 1.3.2 |
Component: | event | Version: | 1.3.1 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
When you leftclick in IE any assigned click handlers will never have a "which" property on their event objects, despite having been through jQuery.event.fix().
The code in question is the following:
Add which for click: 1 == left; 2 == middle; 3 == right
Note: button is not normalized, so don't use it
if ( !event.which && event.button )
event.which = (event.button & 1 ? 1 : ( event.button & 2 ? 3 : ( event.button & 4 ? 2 : 0 ) ));
Since leftclicking sets the button property to 0 the above will never be triggered in IE, and IE will not get a which property on click events.
Attachments (0)
Change History (3)
Changed February 17, 2009 12:32AM UTC by comment:1
Changed May 29, 2009 12:24AM UTC by comment:2
Yeah surprising this bug is still around. event.which should be a reliable way to get the mouse button but it's currently returning "undefined" for the left mouse button.
Changed June 16, 2009 10:33PM UTC by comment:3
resolution: | → invalid |
---|---|
status: | new → closed |
Unfortunately the event.button property is not set for click events. It is however set for mouseup/down/move ... but not click.
So it sounds like the fix is something like: