#4164 closed bug (invalid)
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.
Change History (3)
comment:1 Changed 14 years ago by
comment:2 Changed 14 years ago by
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.
comment:3 Changed 14 years ago by
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: