Skip to content

Commit

Permalink
DeviceOrientationEvent: Define absolute's value on error (#139)
Browse files Browse the repository at this point in the history
SHA: c0f629e
Reason: push, by rakuco

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Raphael Kubo da Costa and github-actions[bot] committed Feb 14, 2024
1 parent 4c33b48 commit 1ba6145
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions index.html
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@
<link href="https://www.w3.org/StyleSheets/TR/2021/W3C-ED" rel="stylesheet">
<meta content="Bikeshed version 82ce88815, updated Thu Sep 7 16:33:55 2023 -0700" name="generator">
<link href="https://www.w3.org/TR/orientation-event/" rel="canonical">
<meta content="39442a24b7fba2669dc37119fc66a46cd430181a" name="document-revision">
<meta content="c0f629e841ef788cda818d17a1d8671b23e87ca3" name="document-revision">
<style>/* Boilerplate: style-autolinks */
.css.css, .property.property, .descriptor.descriptor {
color: var(--a-normal-text);
@@ -1410,7 +1410,7 @@ <h3 class="heading settled" data-level="8.1" id="deviceorientation"><span class=
<p>Invoke <a data-link-type="dfn" href="#fire-an-orientation-event" id="ref-for-fire-an-orientation-event">fire an orientation event</a> with <a class="idl-code" data-link-type="event" href="#def-deviceorientation" id="ref-for-def-deviceorientation⑤"><code>deviceorientation</code></a>, <var>window</var>, and <var>absolute</var>.</p>
</ol>
</div>
<p>If an implementation can never provide orientation information, the event should be fired with the <code class="idl"><a data-link-type="idl" href="#dom-deviceorientationevent-alpha" id="ref-for-dom-deviceorientationevent-alpha⑦">alpha</a></code>, <code class="idl"><a data-link-type="idl" href="#dom-deviceorientationevent-beta" id="ref-for-dom-deviceorientationevent-beta⑥">beta</a></code> and <code class="idl"><a data-link-type="idl" href="#dom-deviceorientationevent-gamma" id="ref-for-dom-deviceorientationevent-gamma⑥">gamma</a></code> attributes set to null.</p>
<p>If an implementation can never provide orientation information, the event should be fired with the <code class="idl"><a data-link-type="idl" href="#dom-deviceorientationevent-alpha" id="ref-for-dom-deviceorientationevent-alpha⑦">alpha</a></code>, <code class="idl"><a data-link-type="idl" href="#dom-deviceorientationevent-beta" id="ref-for-dom-deviceorientationevent-beta⑥">beta</a></code> and <code class="idl"><a data-link-type="idl" href="#dom-deviceorientationevent-gamma" id="ref-for-dom-deviceorientationevent-gamma⑥">gamma</a></code> attributes set to null, and the <code class="idl"><a data-link-type="idl" href="#dom-deviceorientationevent-absolute" id="ref-for-dom-deviceorientationevent-absolute②">absolute</a></code> attribute set to false.</p>
<h3 class="heading settled" data-level="8.2" id="deviceorientationabsolute"><span class="secno">8.2. </span><span class="content">deviceorientationabsolute Event</span><a class="self-link" href="#deviceorientationabsolute"></a></h3>
<div class="issue" id="issue-58b60688"><a class="self-link" href="#issue-58b60688"></a> The <code class="idl"><a data-link-type="idl" href="#def-deviceorientationabsolute" id="ref-for-def-deviceorientationabsolute③">deviceorientationabsolute</a></code> event and its <code class="idl"><a data-link-type="idl" href="#dom-window-ondeviceorientationabsolute" id="ref-for-dom-window-ondeviceorientationabsolute">ondeviceorientationabsolute</a></code> event handler IDL attribute have <a href="https://wpt.fyi/results/orientation-event/ondeviceorientationabsolute.https.html">limited implementation experience</a>. </div>
<pre class="idl highlight def"><c- b>partial</c-> <c- b>interface</c-> <a class="idl-code" data-link-type="interface" href="https://html.spec.whatwg.org/multipage/nav-history-apis.html#window" id="ref-for-window②"><c- g>Window</c-></a> {
@@ -1426,7 +1426,7 @@ <h3 class="heading settled" data-level="8.2" id="deviceorientationabsolute"><spa
<p>Invoke <a data-link-type="dfn" href="#fire-an-orientation-event" id="ref-for-fire-an-orientation-event①">fire an orientation event</a> with <a class="idl-code" data-link-type="event" href="#def-deviceorientationabsolute" id="ref-for-def-deviceorientationabsolute⑤"><code>deviceorientationabsolute</code></a>, <var>window</var>, and true.</p>
</ol>
</div>
<p>If an implementation can never provide absolute orientation information, the event should be fired with the <code class="idl"><a data-link-type="idl" href="#dom-deviceorientationevent-alpha" id="ref-for-dom-deviceorientationevent-alpha⑧">alpha</a></code>, <code class="idl"><a data-link-type="idl" href="#dom-deviceorientationevent-beta" id="ref-for-dom-deviceorientationevent-beta⑦">beta</a></code> and <code class="idl"><a data-link-type="idl" href="#dom-deviceorientationevent-gamma" id="ref-for-dom-deviceorientationevent-gamma⑦">gamma</a></code> attributes set to null.</p>
<p>If an implementation can never provide absolute orientation information, the event should be fired with the <code class="idl"><a data-link-type="idl" href="#dom-deviceorientationevent-alpha" id="ref-for-dom-deviceorientationevent-alpha⑧">alpha</a></code>, <code class="idl"><a data-link-type="idl" href="#dom-deviceorientationevent-beta" id="ref-for-dom-deviceorientationevent-beta⑦">beta</a></code> and <code class="idl"><a data-link-type="idl" href="#dom-deviceorientationevent-gamma" id="ref-for-dom-deviceorientationevent-gamma⑦">gamma</a></code> attributes set to null, and the <code class="idl"><a data-link-type="idl" href="#dom-deviceorientationevent-absolute" id="ref-for-dom-deviceorientationevent-absolute③">absolute</a></code> attribute set to true.</p>
<h3 class="heading settled" data-level="8.3" id="devicemotion"><span class="secno">8.3. </span><span class="content">devicemotion Event</span><a class="self-link" href="#devicemotion"></a></h3>
<h4 class="heading settled" data-level="8.3.1" id="device-motion-event-acceleration-api"><span class="secno">8.3.1. </span><span class="content">The DeviceMotionEventAcceleration interface</span><a class="self-link" href="#device-motion-event-acceleration-api"></a></h4>
<pre class="idl highlight def">[<a class="idl-code" data-link-type="extended-attribute" href="https://webidl.spec.whatwg.org/#Exposed" id="ref-for-Exposed①"><c- g>Exposed</c-></a>=<c- n>Window</c->, <a class="idl-code" data-link-type="extended-attribute" href="https://webidl.spec.whatwg.org/#SecureContext" id="ref-for-SecureContext③"><c- g>SecureContext</c-></a>]
@@ -1883,7 +1883,7 @@ <h3 class="heading settled" id="worked-example"><span class="content">A.1 Calcul
<p>provided that β and γ are not both zero.</p>
<div class="example" id="example-cad08fa0">
<a class="self-link" href="#example-cad08fa0"></a>
<p>The compass heading calculation above can be represented in JavaScript as follows to return the correct compass heading when the provided parameters are defined, not null and represent <code class="idl"><a data-link-type="idl" href="#dom-deviceorientationevent-absolute" id="ref-for-dom-deviceorientationevent-absolute">absolute</a></code> values.</p>
<p>The compass heading calculation above can be represented in JavaScript as follows to return the correct compass heading when the provided parameters are defined, not null and represent <code class="idl"><a data-link-type="idl" href="#dom-deviceorientationevent-absolute" id="ref-for-dom-deviceorientationevent-absolute">absolute</a></code> values.</p>
<pre class="lang-js highlight"><c- a>var</c-> degtorad <c- o>=</c-> Math<c- p>.</c->PI <c- o>/</c-> <c- mf>180</c-><c- p>;</c-> <c- c1>// Degree-to-Radian conversion</c->

<c- a>function</c-> compassHeading<c- p>(</c-> alpha<c- p>,</c-> beta<c- p>,</c-> gamma <c- p>)</c-> <c- p>{</c->
@@ -1932,7 +1932,7 @@ <h3 class="heading settled" id="worked-example-2"><span class="content">A.2 Alte
<p>If R represents the rotation matrix of the device in the earth frame XYZ, then since the initial body frame is aligned with the earth, R is as follows.</p>
<object class="equation" data="equation13a.xhtml" type="application/mathml+xml"> <img alt="R = ZXY = [[cos(alpha) cos(gamma)-sin(alpha) sin(beta) sin(gamma), -cos(beta) sin(alpha), cos(gamma) sin(alpha) sin(beta)+cos(alpha) sin(gamma)], [cos(gamma) sin(alpha)+cos(alpha) sin(beta) sin(gamma), cos(alpha) cos(beta), sin(alpha) sin(gamma)-cos(alpha) cos(gamma) sin(beta)], [-cos(beta) sin(gamma), sin(beta), cos(beta) cos(gamma)]]" height="76" src="equation13a.png" width="763"> </object>
<div class="example" id="example-76d62ad0">
<a class="self-link" href="#example-76d62ad0"></a> The above combined rotation matrix can be represented in JavaScript as follows provided passed parameters are defined, not null and represent <code class="idl"><a data-link-type="idl" href="#dom-deviceorientationevent-absolute" id="ref-for-dom-deviceorientationevent-absolute">absolute</a></code> values.
<a class="self-link" href="#example-76d62ad0"></a> The above combined rotation matrix can be represented in JavaScript as follows provided passed parameters are defined, not null and represent <code class="idl"><a data-link-type="idl" href="#dom-deviceorientationevent-absolute" id="ref-for-dom-deviceorientationevent-absolute">absolute</a></code> values.
<pre class="lang-js highlight"><c- a>var</c-> degtorad <c- o>=</c-> Math<c- p>.</c->PI <c- o>/</c-> <c- mf>180</c-><c- p>;</c-> <c- c1>// Degree-to-Radian conversion</c->

<c- a>function</c-> getRotationMatrix<c- p>(</c-> alpha<c- p>,</c-> beta<c- p>,</c-> gamma <c- p>)</c-> <c- p>{</c->
@@ -1977,7 +1977,7 @@ <h3 class="heading settled" id="worked-example-2"><span class="content">A.2 Alte
<p>If q represents the unit quaternion of the device in the earth frame XYZ, then since the initial body frame is aligned with the earth, q is as follows.</p>
<object class="equation" data="equation14.xhtml" type="application/mathml+xml"> <img alt="q = [[q_w], [q_x], [q_y], [q_z]] = [[cos(beta)cos(gamma)cos(alpha) - sin(beta)sin(gamma)sin(alpha)], [sin(beta)cos(gamma)cos(alpha) - cos(beta)sin(gamma)sin(alpha)], [cos(beta)sin(gamma)cos(alpha) + sin(beta)cos(gamma)sin(alpha)], [cos(beta)cos(gamma)sin(alpha) + sin(beta)sin(gamma)cos(alpha)]]" height="192" src="equation14.png" width="534"> </object>
<div class="example" id="example-8f884833">
<a class="self-link" href="#example-8f884833"></a> The above quaternion can be represented in JavaScript as follows provided the passed parameters are defined, are <code class="idl"><a data-link-type="idl" href="#dom-deviceorientationevent-absolute" id="ref-for-dom-deviceorientationevent-absolute">absolute</a></code> values and those parameters are not null.
<a class="self-link" href="#example-8f884833"></a> The above quaternion can be represented in JavaScript as follows provided the passed parameters are defined, are <code class="idl"><a data-link-type="idl" href="#dom-deviceorientationevent-absolute" id="ref-for-dom-deviceorientationevent-absolute">absolute</a></code> values and those parameters are not null.
<pre class="lang-js highlight"><c- a>var</c-> degtorad <c- o>=</c-> Math<c- p>.</c->PI <c- o>/</c-> <c- mf>180</c-><c- p>;</c-> <c- c1>// Degree-to-Radian conversion</c->

<c- a>function</c-> getQuaternion<c- p>(</c-> alpha<c- p>,</c-> beta<c- p>,</c-> gamma <c- p>)</c-> <c- p>{</c->
@@ -3281,7 +3281,7 @@ <h2 class="no-num no-ref heading settled" id="idl-index"><span class="content">I
window.dfnpanelData['dom-deviceorientationevent-alpha'] = {"dfnID": "dom-deviceorientationevent-alpha", "url": "#dom-deviceorientationevent-alpha", "dfnText": "alpha", "refSections": [{"refs": [{"id": "ref-for-dom-deviceorientationevent-alpha"}, {"id": "ref-for-dom-deviceorientationevent-alpha\u2460"}], "title": "2. Introduction"}, {"refs": [{"id": "ref-for-dom-deviceorientationevent-alpha\u2461"}, {"id": "ref-for-dom-deviceorientationevent-alpha\u2462"}, {"id": "ref-for-dom-deviceorientationevent-alpha\u2463"}], "title": "4.1. Device Orientation"}, {"refs": [{"id": "ref-for-dom-deviceorientationevent-alpha\u2464"}, {"id": "ref-for-dom-deviceorientationevent-alpha\u2465"}, {"id": "ref-for-dom-deviceorientationevent-alpha\u2466"}], "title": "8.1. deviceorientation Event"}, {"refs": [{"id": "ref-for-dom-deviceorientationevent-alpha\u2467"}], "title": "8.2. deviceorientationabsolute Event"}], "external": false};
window.dfnpanelData['dom-deviceorientationevent-beta'] = {"dfnID": "dom-deviceorientationevent-beta", "url": "#dom-deviceorientationevent-beta", "dfnText": "beta", "refSections": [{"refs": [{"id": "ref-for-dom-deviceorientationevent-beta"}], "title": "2. Introduction"}, {"refs": [{"id": "ref-for-dom-deviceorientationevent-beta\u2460"}, {"id": "ref-for-dom-deviceorientationevent-beta\u2461"}, {"id": "ref-for-dom-deviceorientationevent-beta\u2462"}], "title": "4.1. Device Orientation"}, {"refs": [{"id": "ref-for-dom-deviceorientationevent-beta\u2463"}, {"id": "ref-for-dom-deviceorientationevent-beta\u2464"}, {"id": "ref-for-dom-deviceorientationevent-beta\u2465"}], "title": "8.1. deviceorientation Event"}, {"refs": [{"id": "ref-for-dom-deviceorientationevent-beta\u2466"}], "title": "8.2. deviceorientationabsolute Event"}], "external": false};
window.dfnpanelData['dom-deviceorientationevent-gamma'] = {"dfnID": "dom-deviceorientationevent-gamma", "url": "#dom-deviceorientationevent-gamma", "dfnText": "gamma", "refSections": [{"refs": [{"id": "ref-for-dom-deviceorientationevent-gamma"}], "title": "2. Introduction"}, {"refs": [{"id": "ref-for-dom-deviceorientationevent-gamma\u2460"}, {"id": "ref-for-dom-deviceorientationevent-gamma\u2461"}, {"id": "ref-for-dom-deviceorientationevent-gamma\u2462"}], "title": "4.1. Device Orientation"}, {"refs": [{"id": "ref-for-dom-deviceorientationevent-gamma\u2463"}, {"id": "ref-for-dom-deviceorientationevent-gamma\u2464"}, {"id": "ref-for-dom-deviceorientationevent-gamma\u2465"}], "title": "8.1. deviceorientation Event"}, {"refs": [{"id": "ref-for-dom-deviceorientationevent-gamma\u2466"}], "title": "8.2. deviceorientationabsolute Event"}], "external": false};
window.dfnpanelData['dom-deviceorientationevent-absolute'] = {"dfnID": "dom-deviceorientationevent-absolute", "url": "#dom-deviceorientationevent-absolute", "dfnText": "absolute", "refSections": [{"refs": [{"id": "ref-for-dom-deviceorientationevent-absolute"}, {"id": "ref-for-dom-deviceorientationevent-absolute\u2460"}], "title": "8.1. deviceorientation Event"}, {"refs": [{"id": "ref-for-dom-deviceorientationevent-absolute\u2461"}], "title": "A.1 Calculating compass heading"}, {"refs": [{"id": "ref-for-dom-deviceorientationevent-absolute\u2462"}, {"id": "ref-for-dom-deviceorientationevent-absolute\u2463"}], "title": "A.2 Alternate device orientation representations"}], "external": false};
window.dfnpanelData['dom-deviceorientationevent-absolute'] = {"dfnID": "dom-deviceorientationevent-absolute", "url": "#dom-deviceorientationevent-absolute", "dfnText": "absolute", "refSections": [{"refs": [{"id": "ref-for-dom-deviceorientationevent-absolute"}, {"id": "ref-for-dom-deviceorientationevent-absolute\u2460"}, {"id": "ref-for-dom-deviceorientationevent-absolute\u2461"}], "title": "8.1. deviceorientation Event"}, {"refs": [{"id": "ref-for-dom-deviceorientationevent-absolute\u2462"}], "title": "8.2. deviceorientationabsolute Event"}, {"refs": [{"id": "ref-for-dom-deviceorientationevent-absolute\u2463"}], "title": "A.1 Calculating compass heading"}, {"refs": [{"id": "ref-for-dom-deviceorientationevent-absolute\u2464"}, {"id": "ref-for-dom-deviceorientationevent-absolute\u2465"}], "title": "A.2 Alternate device orientation representations"}], "external": false};
window.dfnpanelData['dom-deviceorientationevent-requestpermission'] = {"dfnID": "dom-deviceorientationevent-requestpermission", "url": "#dom-deviceorientationevent-requestpermission", "dfnText": "requestPermission(absolute)", "refSections": [{"refs": [{"id": "ref-for-dom-deviceorientationevent-requestpermission"}], "title": "8.1. deviceorientation Event"}], "external": false};
window.dfnpanelData['fire-an-orientation-event'] = {"dfnID": "fire-an-orientation-event", "url": "#fire-an-orientation-event", "dfnText": "fire an orientation event", "refSections": [{"refs": [{"id": "ref-for-fire-an-orientation-event"}], "title": "8.1. deviceorientation Event"}, {"refs": [{"id": "ref-for-fire-an-orientation-event\u2460"}], "title": "8.2. deviceorientationabsolute Event"}], "external": false};
window.dfnpanelData['significant-change-in-orientation'] = {"dfnID": "significant-change-in-orientation", "url": "#significant-change-in-orientation", "dfnText": "significant change in orientation", "refSections": [{"refs": [{"id": "ref-for-significant-change-in-orientation"}, {"id": "ref-for-significant-change-in-orientation\u2460"}, {"id": "ref-for-significant-change-in-orientation\u2461"}], "title": "8.1. deviceorientation Event"}, {"refs": [{"id": "ref-for-significant-change-in-orientation\u2462"}], "title": "8.2. deviceorientationabsolute Event"}], "external": false};

0 comments on commit 1ba6145

Please sign in to comment.