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 17628 - delta attributes of WheelEvent should be double rather than float
Summary: delta attributes of WheelEvent should be double rather than float
Status: RESOLVED FIXED
Alias: None
Product: WebAppsWG
Classification: Unclassified
Component: HISTORICAL - DOM3 Events (show other bugs)
Version: unspecified
Hardware: All All
: P2 normal
Target Milestone: ---
Assignee: Travis Leithead [MSFT]
QA Contact: public-webapps-bugzilla
URL:
Whiteboard:
Keywords: needsReview
Depends on:
Blocks:
 
Reported: 2012-06-28 10:17 UTC by Masayuki Nakano
Modified: 2012-09-12 04:31 UTC (History)
4 users (show)

See Also:


Attachments

Description Masayuki Nakano 2012-06-28 10:17:05 UTC
I think that the type of deltaX, deltaY and deltaZ attributes of WheelEvent should be double rather than float.

If they are float, the initialized values of untrusted events and the result of the attributes cannot match easily.

For example:

var e = new WheelEvent("wheel", { deltaX: 1/3 });
alert(e.deltaX == 1/3);

The result could be false due to the fractional error.

float is useful when a lot of values are stored in arrays. However, delta values are not so. So, I think that the type of delta values should be double.

The example may not be a realistic situation. However, if web application developers met to this problem, they would feel strange.

Currently, I'm working on implementing D3E WheelEvent on Gecko. We're using double for them.
https://bugzilla.mozilla.org/show_bug.cgi?id=719320
Comment 1 Travis Leithead [MSFT] 2012-08-23 20:29:58 UTC
Double is fine.
Comment 2 Olli Pettay 2012-08-23 20:33:27 UTC
FYI, Gecko uses double already.
Comment 3 Travis Leithead [MSFT] 2012-08-23 20:36:21 UTC
Fixed in revision 237:

http://dev.w3.org/2006/webapi/DOM-Level-3-Events/html/DOM3-Events.html?rev=1.237
Comment 4 Masayuki Nakano 2012-09-12 04:31:21 UTC
nit:

http://www.w3.org/TR/2012/WD-DOM-Level-3-Events-20120906/#events-WheelEvent
  readonly attribute double         deltaX;
  readonly attribute double         deltaY;
  readonly attribute double         deltaZ;
  readonly attribute unsigned long deltaMode;

The indentation is wrong. I guess that you just replaced "float" with "double". The length is increased 1 character.