Bug Tracker

Opened 7 years ago

Closed 7 years ago

#12742 closed bug (cantfix)

The value of 'e.which' always returning '1' in the event of .mousemove() and others on Firefox and IE.

Reported by: WayneSan <waynesan@…> Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.8.2
Keywords: Cc:
Blocked by: Blocking:

Description

The value of 'e.which' always returning '1' in the following events:

  • .mouseenter()
  • .mouseleave()
  • .mousemove()
  • .mouseout()
  • .mouseover()

But it works as expected on Google Chrome.

Here is a test case: http://jsfiddle.net/2c5kz/

Change History (3)

comment:1 Changed 7 years ago by fracmak2

There are multiple problems with the 'which' property. First off, the property has been labeled legacy by the w3c.

http://www.w3.org/TR/DOM-Level-3-Events/#legacy-key-attributes

The 'which' property has an issue with being a dual value property. Under certain circumstances the variable represents a keycode, other times it represents a mouse button index.

What you should be using is the 'buttons' property which is what the spec requires being set on a mousemove/mouseenter/etc/etc

http://www.w3.org/TR/DOM-Level-3-Events/#event-type-mousemove

comment:2 Changed 7 years ago by fracmak2

Further more, webkit doesn't support 'buttons' yet, but firefox does. IE on the other hand doesn't support either. At this point, how do we determine which value is right, without putting in browser and version specific checks (because the browsers will be moving to support buttons eventually).

Here's a new fiddle

http://jsfiddle.net/fracmak/2c5kz/5/

comment:3 Changed 7 years ago by dmethvin

Resolution: cantfix
Status: newclosed

I agree, there's no reasonable way we can normalize or correct this across browsers at the moment. The browsers are lying about the buttons in different ways and there is no way to know when they are telling the truth.

Note: See TracTickets for help on using tickets.