W3C home > Mailing lists > Public > public-device-apis-log@w3.org > September 2018

Re: [deviceorientation] Invalid IDL in DeviceMotionEventInit

From: Boris Zbarsky via GitHub <sysbot+gh@w3.org>
Date: Mon, 24 Sep 2018 20:41:16 +0000
To: public-device-apis-log@w3.org
Message-ID: <issue_comment.created-424117473-1537821675-sysbot+gh@w3.org>
Updating the test sounds great.

As far as the comments in #55 about what is specified or not...

There's no actual text anywhere in https://w3c.github.io/deviceorientation/#devicemotion that describes the steps for the `DeviceMotionEvent` constructor, or indeed any of the other constructors in this specification.  In particular, they do not define any https://dom.spec.whatwg.org/#concept-event-constructor-ext

In the absence of "event constructing steps", https://dom.spec.whatwg.org/#inner-event-creation-steps will end up doing:

> For each _member_ → _value_ in _dictionary,_ if _event_ has an attribute whose identifier is _member_, then initialize that attribute to _value_

OK, so let's take a look at the `acceleration` attribute of `DeviceMotionEventInit`.  This is of type `DeviceAccelerationInit` but the corresponding attribute on the event is of type `DeviceAcceleration?`.  It's not obvious how exactly to initialize the latter from the former.  @annevk how should this work exactly?  Even fixing it up via the "event construction steps" doesn't technically help, because those run after that "initialize that attribute" step...  Maybe the "initialize that attribute" step should not run if the types don't match?

Anyway, the simplest thing here from my point of view would be to:

1. Clarify that https://dom.spec.whatwg.org/#inner-event-creation-steps step 4 does nothing for attributes whose type does not match the init dictionary.
2. Define "event  construction steps" that if the value is not present in the dictionary initialize the attribute to null, else initialize the attribute to a `DeviceAcceleration` whose properties are set to the same values as the values in the `DeviceAccelerationInit`.

GitHub Notification of comment by bzbarsky
Please view or discuss this issue at https://github.com/w3c/deviceorientation/issues/54#issuecomment-424117473 using your GitHub account
Received on Monday, 24 September 2018 20:41:18 UTC

This archive was generated by hypermail 2.4.0 : Monday, 4 July 2022 12:47:55 UTC