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 14053 - Need a spec for WheelEvent constructor
Summary: Need a spec for WheelEvent constructor
Status: RESOLVED LATER
Alias: None
Product: WebAppsWG
Classification: Unclassified
Component: HISTORICAL - DOM3 Events (show other bugs)
Version: unspecified
Hardware: PC All
: P3 enhancement
Target Milestone: ---
Assignee: Travis Leithead [MSFT]
QA Contact: public-webapps-bugzilla
URL:
Whiteboard:
Keywords: needsReview
Depends on: 14051
Blocks:
  Show dependency treegraph
 
Reported: 2011-09-06 18:43 UTC by Kentaro Hara
Modified: 2013-02-04 23:33 UTC (History)
5 users (show)

See Also:


Attachments

Description Kentaro Hara 2011-09-06 18:43:02 UTC
Background: We are planning to make all Events constructible. For example,
CustomEvent already has the spec for its constructor
(http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#interface-customevent).

We propose a spec for WheelEvent constructor as follows:

[Constructor(DOMString type, optional WheelEventInit eventInitDict)]
dictionary WheelEventInit : MouseEventInit {
  float deltaX;
  float deltaY;
  float deltaZ;
  unsigned long deltaMode;
}
Comment 1 Kentaro Hara 2011-09-27 13:43:32 UTC
Correction:

[Constructor(DOMString type, optional WheelEventInit eventInitDict)]
interface WheelEvent : MouseEvent {
  ...
}

dictionary WheelEventInit : MouseEventInit {
  float deltaX;
  float deltaY;
  float deltaZ;
  unsigned long deltaMode;
}
Comment 2 Travis Leithead [MSFT] 2012-03-08 21:16:47 UTC
Assigning to myself to take action on these open bugs.
Comment 3 Travis Leithead [MSFT] 2012-03-09 01:19:34 UTC
Assigned to me; pri 3 (excluding the tracking bug), and sev: enhancement
Comment 4 Travis Leithead [MSFT] 2012-03-19 19:32:21 UTC
(Resolving dependent bugs based on 14051.)
Comment 5 Kentaro Hara 2013-02-04 01:54:04 UTC
Now WheelEvent constructor is on the editor's draft (Thanks for the specing!):
https://dvcs.w3.org/hg/d4e/raw-file/tip/source_respec.htm#constructor-wheelevent

I have a question about a 'deltaMode' attribute. The spec says:

> Initializes the deltaMode attribute on the WheelEvent object to the enumerated values 0, 1, or 2, which represent the amount of pixels scrolled (DOM_DELTA_PIXEL), lines scrolled (DOM_DELTA_LINE), or pages scrolled (DOM_DELTA_PAGE) if the rotation of the wheel would have resulted in scrolling.

What should happen when 123 is passed to deltaMode in a constructor, like this?

  new WheelEvent("type", {deltaMode: 123});

Should we set 123 to deltaMode, or should we just ignore such an invalid value?

The type of 'deltaMode' is speced as 'unsigned long'. As far as I read the WebIDL spec for 'unsigned long' attributes getters/setters, it seems reasonable to set 123 to deltaMode. Is my understanding correct?
Comment 6 Anne 2013-02-04 16:48:36 UTC
It should just set to the given value within the constraints of IDL. We don't want to specialcase specific events.
Comment 7 Travis Leithead [MSFT] 2013-02-04 16:53:08 UTC
(In reply to comment #6)
> It should just set to the given value within the constraints of IDL. We
> don't want to specialcase specific events.

Agreed. If the web developer want to do this for some reason (say they are extending the semantic meaning of the property for their own purposes), we should not artificially limit it. Additionally, if we add future constant values (unlikely), then we don't want older user agents to fail on the new constant values (forward-compatibility principle).
Comment 8 Kentaro Hara 2013-02-04 23:33:35 UTC
Anne, Travis: Thanks for the clarification! That makes sense to me.