This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 20236 - 3.1.1.1 button value -1 isn't possible
Summary: 3.1.1.1 button value -1 isn't possible
Status: RESOLVED FIXED
Alias: None
Product: WebAppsWG
Classification: Unclassified
Component: HISTORICAL - DOM3 Events (show other bugs)
Version: unspecified
Hardware: PC Linux
: P2 normal
Target Milestone: ---
Assignee: Travis Leithead [MSFT]
QA Contact: public-webapps-bugzilla
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-12-04 16:28 UTC by Olli Pettay
Modified: 2014-02-13 22:57 UTC (History)
4 users (show)

See Also:


Attachments

Description Olli Pettay 2012-12-04 16:28:51 UTC
In 3.1.1.1 there is
-1 value for button. That isn't possible since button is unsigned short.
Comment 1 Jacob Rossi [MSFT] 2012-12-04 18:40:15 UTC
Here's my thinking on this issue:

1) Current PE spec text changes the values of button/buttons when firing pointer events
2) Current PE spec text does not change the values used when firing mouse events
3) DOM L3 Events defines button/buttons as an unsigned short
4) D3E implementations do not have interop* on how to handle the edge-case where you create a MouseEvent with a negative value for button.
4) (signed) short allows all the values required by D3E and also those by PE

So my suggestion to resolve this issue is as follows:

1) Leave D3E spec as is.
2) Add to PE spec a partial MouseEvent interface that redefines button and buttons as short instead of unsigned short.
3) Include a note that PE's definition supersedes D3E and that implementations


* Using this test code:
var m = document.createEvent("MouseEvent");
m.initMouseEvent("mousedown", true,true,window,null,0,0,0,0,false,false,false,false, -1, null); 
console.log(m.button)

Gecko: 65535 (wraps around), Webkit: 0 (snaps), IE9: -1
Comment 2 Olli Pettay 2012-12-04 18:48:15 UTC
(In reply to comment #1) 
> 2) Add to PE spec a partial MouseEvent interface that redefines button and
> buttons as short instead of unsigned short.
As far as I know, you can't redefine property to be different type in partial interface.
I'd be surprised if it is possible even in inheriting interface.

Need to check what WebIDL says.
Comment 3 Jacob Rossi [MSFT] 2012-12-04 18:57:19 UTC
The suggestion isn't that a partial interface can redefine another interface. I don't think WebIDL has a convention for one spec to override another. I think the only way to redefine an interface is via explicit spec text that says Pointer Events' definition supersedes DOM L3 Events' definition.

The reason I suggested it be a partial interface is just because we only need to mention button and buttons. No need to completely redefine MouseEvent.
Comment 4 Jacob Rossi [MSFT] 2013-01-29 03:23:09 UTC
Sent mail to WebApps to request this change be made to DOM L3 & UI Events. 

http://lists.w3.org/Archives/Public/www-dom/2013JanMar/0080.html
Comment 5 Travis Leithead [MSFT] 2014-02-13 01:01:00 UTC
Moving (with JRossi's permission) to DOM3 Events.
Comment 6 Travis Leithead [MSFT] 2014-02-13 22:57:19 UTC
Fixed just now in editor's draft:
https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html

unsigned short -> short in various places.