w3c/deviceorientation — pull request #12 by richtr (2014-09-22 10:01:19+00:00)
Title: Add deviceorientation and devicemotion feature detection conformance requirement

We need a way to reliably check if DeviceOrientation and DeviceMotion events are supported in the current user agent.

This addition requires user agents not to expose `window.DeviceOrientationEvent` or `window.DeviceMotionEvent` interfaces if the respective implementation of these events is not available. That is to say, we can reliably check if these events are supported as follows:

if (window.DeviceOrientationEvent) {
// current UA supports DeviceOrientation events. Register our 'deviceorientation' event listener here.
} else {
// current UA does not support DeviceOrientation events. Provide fallback user controls here.
}

and:

if (window.DeviceMotionEvent) {
// current UA supports DeviceMotion events. Register our 'devicemotion' event listener here.
} else {
// current UA does not support DeviceMotion events. Provide fallback user controls here.
}

This is inline with conformance requirements used elsewhere in the web platform e.g. in the HTML specification (see the last paragraph of https://html.spec.whatwg.org/multipage/infrastructure.html#extensibility-2).