Skip to content

Commit 8db450e

Browse files
Use algorithmic style more (#144)
SHA: c0694cb Reason: push, by padenot Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 62df0cc commit 8db450e

1 file changed

Lines changed: 24 additions & 13 deletions

File tree

index.html

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
<title>Web Speech API</title>
66
<meta content="CG-DRAFT" name="w3c-status">
77
<link href="https://www.w3.org/StyleSheets/TR/2021/cg-draft" rel="stylesheet">
8-
<meta content="Bikeshed version 47d87adb7, updated Tue Feb 18 17:18:43 2025 -0800" name="generator">
8+
<meta content="Bikeshed version 60c422380, updated Thu Feb 20 19:11:22 2025 -0800" name="generator">
99
<link href="https://webaudio.github.io/web-speech-api/" rel="canonical">
1010
<link href="https://www.w3.org/2008/site/images/favicon.ico" rel="icon">
11-
<meta content="6356249e3d9389d18ac9a140b29f2828e44f761b" name="revision">
11+
<meta content="c0694cbc3c657ba4ecc15a153afdbdaf33bd23aa" name="revision">
1212
<meta content="dark light" name="color-scheme">
1313
<link href="https://www.w3.org/StyleSheets/TR/2021/dark.css" media="(prefers-color-scheme: dark)" rel="stylesheet" type="text/css">
1414
<style>/* Boilerplate: style-autolinks */
@@ -696,7 +696,7 @@
696696
<div class="head">
697697
<p data-fill-with="logo"><a class="logo" href="https://www.w3.org/"> <img alt="W3C" height="48" src="https://www.w3.org/StyleSheets/TR/2021/logos/W3C" width="72"> </a> </p>
698698
<h1 class="p-name no-ref" id="title">Web Speech API</h1>
699-
<p id="w3c-state"><a href="https://www.w3.org/standards/types/#CG-DRAFT">Draft Community Group Report</a>, <time class="dt-updated" datetime="2025-02-20">20 February 2025</time></p>
699+
<p id="w3c-state"><a href="https://www.w3.org/standards/types/#CG-DRAFT">Draft Community Group Report</a>, <time class="dt-updated" datetime="2025-02-28">28 February 2025</time></p>
700700
<details open>
701701
<summary>More details about this document</summary>
702702
<div data-fill-with="spec-metadata">
@@ -843,7 +843,7 @@ <h2 class="heading settled" data-level="3" id="security"><span class="secno">3.
843843
User consent can include, for example:
844844
<ul>
845845
<li>User click on a visible speech input element which has an obvious graphical representation showing that it will start speech input.
846-
<li>Accepting a permission prompt shown as the result of a call to <a class="idl-code" data-link-type="method" href="#dom-speechrecognition-start" id="ref-for-dom-speechrecognition-start">start()</a>.
846+
<li>Accepting a permission prompt shown as the result of a call to <code class="idl"><a data-link-type="idl" href="#dom-speechrecognition-start" id="ref-for-dom-speechrecognition-start">start()</a></code>.
847847
<li>Consent previously granted to always allow speech input for this web page.
848848
</ul>
849849
<li>
@@ -1002,19 +1002,23 @@ <h4 class="heading settled" data-level="4.1.2" id="speechreco-methods"><span cla
10021002
<dl>
10031003
<dt><dfn class="dfn-paneled idl-code" data-dfn-for="SpeechRecognition" data-dfn-type="method" data-export id="dom-speechrecognition-start"><code>start()</code></dfn> method
10041004
<dd>
1005+
Start the speech recognition process, directly from a microphone on the device.
1006+
When invoked, run the following steps:
10051007
<ol>
10061008
<li data-md>
1007-
<p>Let <var>requestMicrophonePermission</var> to <code>true</code>.</p>
1009+
<p>Let <var>requestMicrophonePermission</var> be a boolan variable set to to <code>true</code>.</p>
10081010
<li data-md>
10091011
<p>Run the <a data-link-type="dfn" href="#start-session-algorithm" id="ref-for-start-session-algorithm">start session algorithm</a> with <var>requestMicrophonePermission</var>.</p>
10101012
</ol>
10111013
<dt><dfn class="dfn-paneled idl-code" data-dfn-for="SpeechRecognition" data-dfn-type="method" data-export data-lt="start(audioTrack)" id="dom-speechrecognition-start-audiotrack"><code>start(<code class="idl"><a data-link-type="idl" href="https://w3c.github.io/mediacapture-main/#dom-mediastreamtrack" id="ref-for-dom-mediastreamtrack①">MediaStreamTrack</a></code> audioTrack)</code></dfn> method
10121014
<dd>
1015+
Start the speech recognition process, using a <code class="idl"><a data-link-type="idl" href="https://w3c.github.io/mediacapture-main/#dom-mediastreamtrack" id="ref-for-dom-mediastreamtrack②">MediaStreamTrack</a></code> When invoked, run the following steps:
10131016
<ol>
10141017
<li data-md>
10151018
<p>Let <var>audioTrack</var> be the first argument.</p>
10161019
<li data-md>
1017-
<p>If <var>audioTrack</var>’s <code class="idl"><a data-link-type="idl" href="https://w3c.github.io/mediacapture-main/#dom-mediastreamtrack-kind" id="ref-for-dom-mediastreamtrack-kind">kind</a></code> attribute is NOT <code>"audio"</code>, throw an <code class="idl"><a data-link-type="idl" href="https://webidl.spec.whatwg.org/#invalidstateerror" id="ref-for-invalidstateerror">InvalidStateError</a></code> and abort these steps.</p>
1020+
<p>If <var>audioTrack</var>’s <code class="idl"><a data-link-type="idl" href="https://w3c.github.io/mediacapture-main/#dom-mediastreamtrack-kind" id="ref-for-dom-mediastreamtrack-kind">kind</a></code> attribute is NOT <code>"audio"</code>,
1021+
throw an <code class="idl"><a data-link-type="idl" href="https://webidl.spec.whatwg.org/#invalidstateerror" id="ref-for-invalidstateerror">InvalidStateError</a></code> and abort these steps.</p>
10181022
<li data-md>
10191023
<p>If <var>audioTrack</var>’s <code class="idl"><a data-link-type="idl" href="https://w3c.github.io/mediacapture-main/#dom-mediastreamtrack-readystate" id="ref-for-dom-mediastreamtrack-readystate">readyState</a></code> attribute is NOT <code>"live"</code>, throw an <code class="idl"><a data-link-type="idl" href="https://webidl.spec.whatwg.org/#invalidstateerror" id="ref-for-invalidstateerror①">InvalidStateError</a></code> and abort these steps.</p>
10201024
<li data-md>
@@ -1039,20 +1043,22 @@ <h4 class="heading settled" data-level="4.1.2" id="speechreco-methods"><span cla
10391043
<dt><dfn class="dfn-paneled idl-code" data-dfn-for="SpeechRecognition" data-dfn-type="method" data-export data-lt="installOnDevice(lang)" id="dom-speechrecognition-installondevice"><code>installOnDevice(<code class="idl"><a data-link-type="idl" href="https://webidl.spec.whatwg.org/#idl-DOMString" id="ref-for-idl-DOMString①⓪">DOMString</a></code> lang)</code></dfn> method
10401044
<dd>The installOnDevice method returns a Promise that resolves to a boolean indicating whether the installation of on-device speech recognition for a given BCP 47 language tag initiated successfully. <a data-link-type="biblio" href="#biblio-bcp47" title="Tags for Identifying Languages">[BCP47]</a>
10411045
</dl>
1042-
<p>When the <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="start-session-algorithm">start session algorithm</dfn> with <var>requestMicrophonePermission</var> is invoked, the user agent MUST run the following steps: </p>
1046+
<p>When the <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="start-session-algorithm">start session algorithm</dfn> with <var>requestMicrophonePermission</var> is invoked, the user agent MUST run the
1047+
following steps:</p>
10431048
<ol>
10441049
<li data-md>
10451050
<p>If the <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#current-settings-object" id="ref-for-current-settings-object">current settings object</a>’s <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#concept-relevant-global" id="ref-for-concept-relevant-global">relevant global object</a>’s <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/nav-history-apis.html#concept-document-window" id="ref-for-concept-document-window">associated Document</a> is NOT <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/document-sequences.html#fully-active" id="ref-for-fully-active">fully active</a>, throw an <code class="idl"><a data-link-type="idl" href="https://webidl.spec.whatwg.org/#invalidstateerror" id="ref-for-invalidstateerror②">InvalidStateError</a></code> and abort these steps.</p>
10461051
<li data-md>
1047-
<p>If <code class="idl"><a data-link-type="idl" href="#dom-speechrecognition-started-slot" id="ref-for-dom-speechrecognition-started-slot">[[started]]</a></code> is <code>true</code> and no <a class="idl-code" data-link-type="event" href="#eventdef-speechrecognition-error" id="ref-for-eventdef-speechrecognition-error②">error</a> or <a class="idl-code" data-link-type="event" href="#eventdef-speechrecognition-end" id="ref-for-eventdef-speechrecognition-end③">end</a> event has fired, throw an <code class="idl"><a data-link-type="idl" href="https://webidl.spec.whatwg.org/#invalidstateerror" id="ref-for-invalidstateerror③">InvalidStateError</a></code> and abort these steps.</p>
1052+
<p>If <code class="idl"><a data-link-type="idl" href="#dom-speechrecognition-started-slot" id="ref-for-dom-speechrecognition-started-slot">[[started]]</a></code> is <code>true</code> and no <a class="idl-code" data-link-type="event" href="#eventdef-speechrecognition-error" id="ref-for-eventdef-speechrecognition-error②">error</a> or <a class="idl-code" data-link-type="event" href="#eventdef-speechrecognition-end" id="ref-for-eventdef-speechrecognition-end③">end</a> event
1053+
have fired, throw an <code class="idl"><a data-link-type="idl" href="https://webidl.spec.whatwg.org/#invalidstateerror" id="ref-for-invalidstateerror③">InvalidStateError</a></code> and abort these steps.</p>
10481054
<li data-md>
10491055
<p>Set <code class="idl"><a data-link-type="idl" href="#dom-speechrecognition-started-slot" id="ref-for-dom-speechrecognition-started-slot①">[[started]]</a></code> to <code>true</code>.</p>
10501056
<li data-md>
1051-
<p>If <var>requestMicrophonePermission</var> is <code>true</code> and <a data-link-type="dfn" href="https://w3c.github.io/permissions/#dfn-request-permission-to-use" id="ref-for-dfn-request-permission-to-use">request permission to use</a> "<code>microphone</code>" is <a data-link-type="dfn" href="https://w3c.github.io/permissions/#dfn-denied" id="ref-for-dfn-denied">"denied"</a>, abort these steps.</p>
1057+
<p>If <var>requestMicrophonePermission</var> is <code>true</code> and <a data-link-type="dfn" href="https://w3c.github.io/permissions/#dfn-request-permission-to-use" id="ref-for-dfn-request-permission-to-use">request permission to use</a> "<code>microphone</code>" is <a data-link-type="dfn" href="https://w3c.github.io/permissions/#dfn-denied" id="ref-for-dfn-denied">"denied"</a>, abort
1058+
these steps.</p>
10521059
<li data-md>
1053-
<p>Once the system is successfully listening to the recognition, <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#concept-event-fire" id="ref-for-concept-event-fire">fire an event</a> named <a class="idl-code" data-link-type="event" href="#eventdef-speechrecognition-start" id="ref-for-eventdef-speechrecognition-start">start</a> at <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this">this</a>.</p>
1060+
<p>Once the system is successfully listening to the recognition, queue a task to <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#concept-event-fire" id="ref-for-concept-event-fire">fire an event</a> named <a class="idl-code" data-link-type="event" href="#eventdef-speechrecognition-start" id="ref-for-eventdef-speechrecognition-start">start</a> at <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this">this</a>.</p>
10541061
</ol>
1055-
<p></p>
10561062
<h4 class="heading settled" data-level="4.1.3" id="speechreco-events"><span class="secno">4.1.3. </span><span class="content">SpeechRecognition Events</span><a class="self-link" href="#speechreco-events"></a></h4>
10571063
<p>The DOM Level 2 Event Model is used for speech recognition events.
10581064
The methods in the EventTarget interface should be used for registering event listeners.
@@ -2386,7 +2392,7 @@ <h2 class="no-num no-ref heading settled" id="issues-index"><span class="content
23862392
"889e932f": {"dfnID":"889e932f","dfnText":"Exposed","external":true,"refSections":[{"refs":[{"id":"ref-for-Exposed"},{"id":"ref-for-Exposed\u2460"},{"id":"ref-for-Exposed\u2461"},{"id":"ref-for-Exposed\u2462"},{"id":"ref-for-Exposed\u2463"},{"id":"ref-for-Exposed\u2464"}],"title":"4.1. The SpeechRecognition Interface"},{"refs":[{"id":"ref-for-Exposed\u2465"},{"id":"ref-for-Exposed\u2466"},{"id":"ref-for-Exposed\u2467"},{"id":"ref-for-Exposed\u2468"},{"id":"ref-for-Exposed\u2460\u24ea"}],"title":"4.2. The SpeechSynthesis Interface"}],"url":"https://webidl.spec.whatwg.org/#Exposed"},
23872393
"9cce47fd": {"dfnID":"9cce47fd","dfnText":"sequence","external":true,"refSections":[{"refs":[{"id":"ref-for-idl-sequence"}],"title":"4.2. The SpeechSynthesis Interface"}],"url":"https://webidl.spec.whatwg.org/#idl-sequence"},
23882394
"a5c91173": {"dfnID":"a5c91173","dfnText":"SameObject","external":true,"refSections":[{"refs":[{"id":"ref-for-SameObject"}],"title":"4.2. The SpeechSynthesis Interface"}],"url":"https://webidl.spec.whatwg.org/#SameObject"},
2389-
"bc1e4fa1": {"dfnID":"bc1e4fa1","dfnText":"MediaStreamTrack","external":true,"refSections":[{"refs":[{"id":"ref-for-dom-mediastreamtrack"}],"title":"4.1. The SpeechRecognition Interface"},{"refs":[{"id":"ref-for-dom-mediastreamtrack\u2460"}],"title":"4.1.2. SpeechRecognition Methods"}],"url":"https://w3c.github.io/mediacapture-main/#dom-mediastreamtrack"},
2395+
"bc1e4fa1": {"dfnID":"bc1e4fa1","dfnText":"MediaStreamTrack","external":true,"refSections":[{"refs":[{"id":"ref-for-dom-mediastreamtrack"}],"title":"4.1. The SpeechRecognition Interface"},{"refs":[{"id":"ref-for-dom-mediastreamtrack\u2460"},{"id":"ref-for-dom-mediastreamtrack\u2461"}],"title":"4.1.2. SpeechRecognition Methods"}],"url":"https://w3c.github.io/mediacapture-main/#dom-mediastreamtrack"},
23902396
"bcc085e3": {"dfnID":"bcc085e3","dfnText":"request permission to use","external":true,"refSections":[{"refs":[{"id":"ref-for-dfn-request-permission-to-use"}],"title":"4.1.2. SpeechRecognition Methods"}],"url":"https://w3c.github.io/permissions/#dfn-request-permission-to-use"},
23912397
"bdbd19d1": {"dfnID":"bdbd19d1","dfnText":"Promise","external":true,"refSections":[{"refs":[{"id":"ref-for-idl-promise"},{"id":"ref-for-idl-promise\u2460"}],"title":"4.1. The SpeechRecognition Interface"}],"url":"https://webidl.spec.whatwg.org/#idl-promise"},
23922398
"d36324c1": {"dfnID":"d36324c1","dfnText":"readyState","external":true,"refSections":[{"refs":[{"id":"ref-for-dom-mediastreamtrack-readystate"}],"title":"4.1.2. SpeechRecognition Methods"}],"url":"https://w3c.github.io/mediacapture-main/#dom-mediastreamtrack-readystate"},
@@ -3149,7 +3155,12 @@ <h2 class="no-num no-ref heading settled" id="issues-index"><span class="content
31493155
function showRefHint(link) {
31503156
if(link.classList.contains("dfn-link")) return;
31513157
const url = link.getAttribute("href");
3152-
const ref = refsData[url];
3158+
const refHintKey = link.getAttribute("data-refhint-key");
3159+
let key = url;
3160+
if(refHintKey) {
3161+
key = refHintKey + "_" + url;
3162+
}
3163+
const ref = refsData[key];
31533164
if(!ref) return;
31543165

31553166
hideAllRefHints(); // Only display one at this time.

0 commit comments

Comments
 (0)