Skip to main content

Bug Tracker

Side navigation

#12699 closed feature (invalid)

Opened October 11, 2012 01:18AM UTC

Closed October 27, 2012 08:48AM UTC

Last modified December 05, 2012 12:19AM UTC

Implement event.which normalization inside .click() handler

Reported by: Ult Combo Owned by: Ult Combo
Priority: low Milestone: None
Component: event Version: 1.8.2
Keywords: ie7 ie7 ie8 Cc:
Blocked by: Blocking:
Description

event.which already normalizes button presses for mousedown/mouseup events, is there any reason for it to not be implemented for the click event?

I thought jQuery would have normalized the event object for the click event as it does for the other mouse events, so I've coded it directly into my source without even looking at the documentation and just spent half of an hour pulling my hair because IE6-8 returns 0 for a left click inside the .click handler.

Test case

Is it possible to implement the button normalization for the .click() handler?

Attachments (0)
Change History (6)

Changed October 11, 2012 01:29AM UTC by Ult Combo comment:1

_comment0: I will note that IE9, Firefox, Chrome, Opera and Safari already return `1` for a left click.1349919017549890

Also IE9, Firefox, Chrome, Opera and Safari already return 1 for a left click.

Changed October 12, 2012 09:47PM UTC by dmethvin comment:2

component: unfiledevent
keywords: → ie7 ie7 ie8
owner: → Ult Combo
priority: undecidedlow
status: newpending

See #11741. The problem is that IE's event object doesn't set which properly. However, a click event only occurs on left click as far as I know, so it should not be required to inspect event.which to see what button was down. We could try to fake it and always set event.which to 1 but history has shown that tends to bite us in strange ways as well.

Is there a reason why you're checking event.which in a click handler?

Changed October 12, 2012 09:51PM UTC by dmethvin comment:3

#12705 is a duplicate of this ticket.

Changed October 27, 2012 08:48AM UTC by trac-o-bot comment:4

resolution: → invalid
status: pendingclosed

Because we get so many tickets, we often need to return them to the initial reporter for more information. If that person does not reply within 14 days, the ticket will automatically be closed, and that has happened in this case. If you still are interested in pursuing this issue, feel free to add a comment with the requested information and we will be happy to reopen the ticket if it is still valid. Thanks!

Changed November 08, 2012 01:01AM UTC by Ult Combo comment:5

Woah, I almost completely forgot about this ticket.

The reason I was checking for event.which is simply that some browsers do fire the click event for the middle button (Chrome and Firefox) and even for the right button (Firefox) as shown in the ticket's test case.

So I just wanted to warrant that the user was pressing the left click. But I agree that might just be extra hackishness possibly not worth to be included in the core, checking for event.which <= 1 should suffice for my use case.

Changed December 05, 2012 12:19AM UTC by JewelPengin comment:6

This is still an issue and seeing as the documentation clearly states that event.which is normalized, this should be a much higher priority IMHO.