Skip to main content

Bug Tracker

Side navigation

#12742 closed bug (cantfix)

Opened October 16, 2012 12:37PM UTC

Closed October 16, 2012 02:55PM UTC

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

Reported by: WayneSan <waynesan@zerozone.tw> 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/

Attachments (0)
Change History (3)

Changed October 16, 2012 02:44PM UTC by fracmak2 comment:1

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

Changed October 16, 2012 02:52PM UTC by fracmak2 comment:2

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/

Changed October 16, 2012 02:55PM UTC by dmethvin comment:3

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.