Skip to content

Commit

Permalink
Editorial: replace uses of the Type macro with is-a tests
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelficarra authored Oct 28, 2024
1 parent d777381 commit 27f948a
Showing 1 changed file with 19 additions and 11 deletions.
30 changes: 19 additions & 11 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -2996,7 +2996,13 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
<li>The <dfn data-x="js-prod-Pattern" data-x-href="https://tc39.es/ecma262/#prod-Pattern"><i>Pattern</i></dfn> production</li>
<li>The <dfn data-x="js-prod-Script" data-x-href="https://tc39.es/ecma262/#prod-Script"><i>Script</i></dfn> production</li>

<li>The <dfn data-x="js-Type" data-x-href="https://tc39.es/ecma262/#sec-ecmascript-data-types-and-values">Type</dfn> notation</li>
<li>The
<dfn data-x="js-BigInt" data-x-href="https://tc39.es/ecma262/#sec-ecmascript-language-types-bigint-type">BigInt</dfn>,
<dfn data-x="js-Boolean" data-x-href="https://tc39.es/ecma262/#sec-ecmascript-language-types-boolean-type">Boolean</dfn>,
<dfn data-x="js-Number" data-x-href="https://tc39.es/ecma262/#sec-ecmascript-language-types-number-type">Number</dfn>,
<dfn data-x="js-String" data-x-href="https://tc39.es/ecma262/#sec-ecmascript-language-types-string-type">String</dfn>,
<dfn data-x="js-Symbol" data-x-href="https://tc39.es/ecma262/#sec-ecmascript-language-types-symbol-type">Symbol</dfn>,
and <dfn data-x="js-Object" data-x-href="https://tc39.es/ecma262/#sec-object-type">Object</dfn> ECMAScript language types</li>
<li>The <dfn data-x-href="https://tc39.es/ecma262/#sec-completion-record-specification-type">Completion Record</dfn> specification type</li>
<li>The <dfn data-x="js-List" data-x-href="https://tc39.es/ecma262/#sec-list-and-record-specification-type">List</dfn> and
<dfn data-x-href="https://tc39.es/ecma262/#sec-list-and-record-specification-type">Record</dfn> specification types</li>
Expand Down Expand Up @@ -9653,11 +9659,12 @@ interface <dfn interface>DOMStringList</dfn> {

<li><p>Let <var>deep</var> be false.</p></li>

<li><p>If <span data-x="js-Type">Type</span>(<var>value</var>) is Undefined, Null, Boolean,
Number, BigInt, or String, then return { [[Type]]: "primitive",
[[Value]]: <var>value</var> }.</p></li>
<li><p>If <var>value</var> is undefined, null, <span data-x="js-Boolean">a Boolean</span>, <span
data-x="js-Number">a Number</span>, <span data-x="js-BigInt">a BigInt</span>, or <span
data-x="js-String">a String</span>, then return { [[Type]]: "primitive", [[Value]]:
<var>value</var> }.</p></li>

<li><p>If <span data-x="js-Type">Type</span>(<var>value</var>) is Symbol, then throw a
<li><p>If <var>value</var> <span data-x="js-Symbol">is a Symbol</span>, then throw a
<span>"<code>DataCloneError</code>"</span> <code>DOMException</code>.</p></li>

<li><p>Let <var>serialized</var> be an uninitialized value.</p></li>
Expand Down Expand Up @@ -12157,7 +12164,7 @@ document.createElement("bad-1"); // (2)</code></pre>
"prototype").</p></li>

<li>
<p>If <span data-x="js-Type">Type</span>(<var>prototype</var>) is not Object, then:</p>
<p>If <var>prototype</var> <span data-x="js-Object">is not an Object</span>, then:</p>

<ol>
<li><p>Let <var>realm</var> be ? <span>GetFunctionRealm</span>(<span>NewTarget</span>).</p></li>
Expand Down Expand Up @@ -71432,10 +71439,10 @@ interface <dfn interface>OffscreenCanvasRenderingContext2D</dfn> {

<p>If <var>type</var> is an image format that supports variable quality (such as
"<code>image/jpeg</code>"), <var>quality</var> is given, and <var>type</var> is not
"<code>image/png</code>", then, if <span data-x="js-Type">Type</span>(<var>quality</var>) is
Number, and <var>quality</var> is in the range 0.0 to 1.0 inclusive, the user agent must treat
<var>quality</var> as the desired quality level. Otherwise, the user agent must use its default
quality value, as if the <var>quality</var> argument had not been given.</p>
"<code>image/png</code>", then, if <var>quality</var> <span data-x="js-Number">is a Number</span>
in the range 0.0 to 1.0 inclusive, the user agent must treat <var>quality</var> as the desired
quality level. Otherwise, the user agent must use its default quality value, as if the
<var>quality</var> argument had not been given.</p>

<p class="note">The use of type-testing here, instead of simply declaring <var>quality</var> as
a Web IDL <code data-x="">double</code>, is a historical artifact.</p>
Expand Down Expand Up @@ -72658,7 +72665,7 @@ dictionary <dfn dictionary>ElementDefinitionOptions</dfn> {
<li><p>Let <var>prototype</var> be ? <span data-x="js-Get">Get</span>(<var>constructor</var>,
"prototype").</p></li>

<li><p>If <span data-x="js-Type">Type</span>(<var>prototype</var>) is not Object, then throw a
<li><p>If <var>prototype</var> <span data-x="js-Object">is not an Object</span>, then throw a
<code>TypeError</code> exception.</p></li>

<li><p>Let <var>lifecycleCallbacks</var> be a map with the keys "<code
Expand Down Expand Up @@ -145431,6 +145438,7 @@ INSERT INTERFACES HERE
Michael Day,
Michael Dyck,
Michael Enright,
Michael Ficarra,
Michael Gratton,
Michael Kohler,
Michael McKelvey,
Expand Down

0 comments on commit 27f948a

Please sign in to comment.