Skip to content

Commit

Permalink
Editorial: consistently link "promise resolved/rejected with"
Browse files Browse the repository at this point in the history
  • Loading branch information
domenic authored and annevk committed Nov 22, 2022
1 parent 6ff86f1 commit ae3c911
Showing 1 changed file with 35 additions and 30 deletions.
65 changes: 35 additions & 30 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -2756,6 +2756,7 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
<dfn data-x="es-constructing-callback-functions" data-x-href="https://webidl.spec.whatwg.org/#construct-a-callback-function">constructing</dfn> callback functions</li>
<li><dfn data-x-href="https://webidl.spec.whatwg.org/#dfn-overload-resolution-algorithm">overload resolution algorithm</dfn></li>
<li><dfn data-x="idl-exposed" data-x-href="https://webidl.spec.whatwg.org/#dfn-exposed">exposed</dfn></li>
<li><dfn data-x-href="https://webidl.spec.whatwg.org/#a-promise-resolved-with">a promise resolved with</dfn></li>
<li><dfn data-x-href="https://webidl.spec.whatwg.org/#a-promise-rejected-with">a promise rejected with</dfn></li>
<li><dfn data-x-href="https://webidl.spec.whatwg.org/#upon-rejection">upon rejection</dfn></li>
<li><dfn data-x="LegacyFactoryFunction" data-x-href="https://webidl.spec.whatwg.org/#LegacyFactoryFunction"><code>[LegacyFactoryFunction]</code></dfn></li>
Expand Down Expand Up @@ -36509,14 +36510,16 @@ interface <dfn interface>MediaError</dfn> {
steps.</p>

<ol>
<li><p>If the <span>media element</span> is not <span>allowed to play</span>, return a promise
rejected with a <span>"<code>NotAllowedError</code>"</span> <code>DOMException</code>.</p></li>
<li><p>If the <span>media element</span> is not <span>allowed to play</span>, then return
<span>a promise rejected with</span> a <span>"<code>NotAllowedError</code>"</span>
<code>DOMException</code>.</p></li>

<li>
<p>If the <span>media element</span>'s <code data-x="dom-media-error">error</code> attribute is
not null and its <span data-x="concept-MediaError-code">code</span> is <code
data-x="dom-MediaError-MEDIA_ERR_SRC_NOT_SUPPORTED">MEDIA_ERR_SRC_NOT_SUPPORTED</code>, return a
promise rejected with a <span>"<code>NotSupportedError</code>"</span> <code>DOMException</code>.</p>
data-x="dom-MediaError-MEDIA_ERR_SRC_NOT_SUPPORTED">MEDIA_ERR_SRC_NOT_SUPPORTED</code>, then
return <span>a promise rejected with</span> a <span>"<code>NotSupportedError</code>"</span>
<code>DOMException</code>.</p>

<p class="note">This means that the <span>dedicated media source failure steps</span> have run.
Playback is not possible until the <span>media element load algorithm</span> clears the <code
Expand Down Expand Up @@ -68190,19 +68193,20 @@ interface <dfn interface>OffscreenCanvas</dfn> : <span>EventTarget</span> {

<ol>
<li><p>If the value of this <code>OffscreenCanvas</code> object's <span>[[Detached]]</span>
internal slot is set to true, then return a promise rejected with an
internal slot is set to true, then return <span>a promise rejected with</span> an
<span>"<code>InvalidStateError</code>"</span> <code>DOMException</code>.</p></li>

<li><p>If this <code>OffscreenCanvas</code> object's <span
data-x="offscreencanvas-context-mode">context mode</span> is <span
data-x="offscreencanvas-context-2d">2d</span> and the rendering context's <span
data-x="offscreencontext2d-bitmap">bitmap</span>'s <span
data-x="offscreencontext2d-origin-clean">origin-clean</span> flag is set to false, then return a
promise rejected with a <span>"<code>SecurityError</code>"</span> <code>DOMException</code>.</p>
data-x="offscreencontext2d-origin-clean">origin-clean</span> flag is set to false, then return
<span>a promise rejected with</span> a <span>"<code>SecurityError</code>"</span>
<code>DOMException</code>.</p>

<li><p>If this <code>OffscreenCanvas</code> object's <span
data-x="offscreencanvas-bitmap">bitmap</span> has no pixels (i.e., either its
horizontal dimension or its vertical dimension is zero) then return a promise rejected with an
data-x="offscreencanvas-bitmap">bitmap</span> has no pixels (i.e., either its horizontal
dimension or its vertical dimension is zero) then return <span>a promise rejected with</span> an
<span>"<code>IndexSizeError</code>"</span> <code>DOMException</code>.</p></li>

<li><p>Let <var>bitmap</var> be a copy of this <code>OffscreenCanvas</code> object's <span
Expand Down Expand Up @@ -69832,12 +69836,13 @@ dictionary <dfn dictionary>ElementDefinitionOptions</dfn> {
must run these steps:</p>

<ol>
<li><p>If <var>name</var> is not a <span>valid custom element name</span>, then return a new
promise rejected with a <span>"<code>SyntaxError</code>"</span> <code>DOMException</code>.</p></li>
<li><p>If <var>name</var> is not a <span>valid custom element name</span>, then return <span>a
promise rejected with</span> a <span>"<code>SyntaxError</code>"</span>
<code>DOMException</code>.</p></li>

<li><p>If this <code>CustomElementRegistry</code> contains an entry with <span
data-x="concept-custom-element-definition-name">name</span> <var>name</var>, then return a new
promise resolved with that entry's <span
data-x="concept-custom-element-definition-name">name</span> <var>name</var>, then return <span>a
promise resolved with</span> that entry's <span
data-x="concept-custom-element-definition-constructor">constructor</span>.</p></li>

<li><p>Let <var>map</var> be this <code>CustomElementRegistry</code>'s <span>when-defined
Expand Down Expand Up @@ -97148,8 +97153,8 @@ document.querySelector("button").addEventListener("click", bound);
<ol>
<li><p>Let <var>settings</var> be the <span>settings object</span> of <var>script</var>.</p></li>

<li><p><span>Check if we can run script</span> with <var>settings</var>. If this returns "do
not run", then return a promise resolved with undefined.</p></li>
<li><p><span>Check if we can run script</span> with <var>settings</var>. If this returns "do not
run", then return <span>a promise resolved with</span> with undefined.</p></li>

<li><p><span>Prepare to run script</span> given <var>settings</var>.</p></li>

Expand Down Expand Up @@ -100148,7 +100153,7 @@ import "https://example.com/foo/../module2.mjs";</code></pre>
<li><p>Let <var>parsed</var> be the result of <span data-x="parse a URL">parsing</span>
<var>string</var> relative to the <span>current settings object</span>.</p></li>

<li><p>If <var>parsed</var> is failure, return a promise rejected with a
<li><p>If <var>parsed</var> is failure, then return <span>a promise rejected with</span> a
<span>"<code>SyntaxError</code>"</span> <code>DOMException</code>.</p></li>

<li><p>Let <var>serialized</var> be the result of applying the <span
Expand Down Expand Up @@ -103912,22 +103917,22 @@ dictionary <dfn dictionary>ImageBitmapOptions</dfn> {
when invoked, must run these steps:</p>

<ol>
<li><p>Let <var>p</var> be a new promise.</p></li>

<li><p>If either <var>sw</var> or <var>sh</var> is given and is 0, then return <var>p</var>
rejected with a <code data-x="js-RangeError">RangeError</code>.</p></li>
<li><p>If either <var>sw</var> or <var>sh</var> is given and is 0, then return <span>a promise
rejected with</span> a <code data-x="js-RangeError">RangeError</code>.</p></li>

<li><p>If either <var>options</var>'s <dfn dict-member for="ImageBitmapOptions"><code
data-x="dom-ImageBitmapOptions-resizeWidth">resizeWidth</code></dfn> or <var>options</var>'s <dfn
dict-member for="ImageBitmapOptions"><code
data-x="dom-ImageBitmapOptions-resizeWidth">resizeWidth</code></dfn> or <var>options</var>'s
<dfn dict-member for="ImageBitmapOptions"><code
data-x="dom-ImageBitmapOptions-resizeHeight">resizeHeight</code></dfn> is present and is 0, then
return <var>p</var> rejected with an <span>"<code>InvalidStateError</code>"</span>
return <span>a promise rejected with</span> an <span>"<code>InvalidStateError</code>"</span>
<code>DOMException</code>.</p></li>

<li><p><span>Check the usability of the <var>image</var> argument</span>. If this throws an
exception or returns <i>bad</i>, then return <var>p</var> rejected with an
exception or returns <i>bad</i>, then return <span>a promise rejected with</span> an
<span>"<code>InvalidStateError</code>"</span> <code>DOMException</code>.

<li><p>Let <var>p</var> be a new promise.</p></li>

<li><p>Let <var>imageBitmap</var> be a new <code>ImageBitmap</code> object.</p></li>

<li>
Expand All @@ -103941,8 +103946,8 @@ dictionary <dfn dictionary>ImageBitmapOptions</dfn> {
<li><p>If <var>image</var>'s media data has no <span>intrinsic dimensions</span> (e.g., it's
a vector graphic with no specified content size) and either <var>options</var>'s <code
data-x="dom-ImageBitmapOptions-resizeWidth">resizeWidth</code> or <var>options</var>'s <code
data-x="dom-ImageBitmapOptions-resizeHeight">resizeHeight</code> is not present, then return
<var>p</var> rejected with an <span>"<code>InvalidStateError</code>"</span>
data-x="dom-ImageBitmapOptions-resizeHeight">resizeHeight</code> is not present, then
<span>a promise rejected with</span> an <span>"<code>InvalidStateError</code>"</span>
<code>DOMException</code>.</p></li>

<li><p>If <var>image</var>'s media data has no <span>intrinsic dimensions</span> (e.g., it's
Expand Down Expand Up @@ -103978,7 +103983,7 @@ dictionary <dfn dictionary>ImageBitmapOptions</dfn> {
<ol>
<li><p>If <var>image</var>'s <code data-x="dom-media-networkState">networkState</code>
attribute is <code data-x="dom-media-NETWORK_EMPTY">NETWORK_EMPTY</code>, then return
<var>p</var> rejected with an <span>"<code>InvalidStateError</code>"</span>
<span>a promise rejected with</span> an <span>"<code>InvalidStateError</code>"</span>
<code>DOMException</code>.</p></li>

<li><p>Set <var>imageBitmap</var>'s <span data-x="concept-ImageBitmap-bitmap-data">bitmap
Expand Down Expand Up @@ -104065,8 +104070,8 @@ dictionary <dfn dictionary>ImageBitmapOptions</dfn> {
data-x="dom-imagedata-data">data</code> attribute value's [[ViewedArrayBuffer]] internal
slot.</p></li>

<li><p>If <span>IsDetachedBuffer</span>(<var>buffer</var>) is true, then return <var>p</var>
rejected with an <span>"<code>InvalidStateError</code>"</span>
<li><p>If <span>IsDetachedBuffer</span>(<var>buffer</var>) is true, then return <span>a
promise rejected with</span> an <span>"<code>InvalidStateError</code>"</span>
<code>DOMException</code>.</p></li>

<li><p>Set <var>imageBitmap</var>'s <span data-x="concept-ImageBitmap-bitmap-data">bitmap
Expand Down Expand Up @@ -109151,7 +109156,7 @@ dictionary <dfn dictionary>WorkletOptions</dfn> {
<li><p><span data-x="parse a url">Parse</span> <var>moduleURL</var> relative to
<var>outsideSettings</var>.</p></li>

<li><p>If this fails, then return a promise rejected with a
<li><p>If this fails, then return <span>a promise rejected with</span> a
<span>"<code>SyntaxError</code>"</span> <code>DOMException</code>.</p></li>

<li><p>Let <var>moduleURLRecord</var> be the <span>resulting URL record</span>.</p></li>
Expand Down

0 comments on commit ae3c911

Please sign in to comment.