Skip to content

Commit 6844bc4

Browse files
authored
Align a bit with Infra
This will make IDL adopt https://infra.spec.whatwg.org/#javascript-string-convert rather than have its own algorithm ("obtain Unicode" also known as "convert to a sequence of Unicode scalar values" also known as "convert a DOMString to a sequence of Unicode scalar values").
1 parent 225a115 commit 6844bc4

File tree

1 file changed

+2
-39
lines changed

1 file changed

+2
-39
lines changed

index.bs

Lines changed: 2 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -6060,43 +6060,6 @@ of specifications using Web IDL might want to obtain a sequence of
60606060
[=Unicode scalar values=] given a particular sequence of
60616061
[=code units=].
60626062

6063-
<div algorithm>
6064-
6065-
The following algorithm defines a way to
6066-
<dfn id="dfn-obtain-unicode" export lt="obtain Unicode|convert to a sequence of Unicode scalar values">convert a DOMString to a sequence of Unicode scalar values</dfn>:
6067-
6068-
1. Let |S| be the {{DOMString}} value.
6069-
1. Let |n| be the length of |S|.
6070-
1. Initialize |i| to 0.
6071-
1. Initialize |U| to be an empty sequence of Unicode characters.
6072-
1. While |i| &lt; |n|:
6073-
1. Let |c| be the [=code unit=] in |S| at index |i|.
6074-
1. Depending on the value of |c|:
6075-
<dl class="switch">
6076-
: |c| &lt; 0xD800 or |c| &gt; 0xDFFF
6077-
:: Append to |U| the Unicode character with code point |c|.
6078-
: 0xDC00 ≤ |c| ≤ 0xDFFF
6079-
:: Append to |U| a <span class="char">U+FFFD REPLACEMENT CHARACTER</span>.
6080-
: 0xD800 ≤ |c| ≤ 0xDBFF
6081-
:: <ol class="only">
6082-
1. If |i| = |n|−1, then append to |U| a <span class="char">U+FFFD REPLACEMENT CHARACTER</span>.
6083-
1. Otherwise, |i| &lt; |n|−1:
6084-
1. Let |d| be the code unit in |S| at index
6085-
|i|+1.
6086-
1. If 0xDC00 ≤ |d| ≤ 0xDFFF, then:
6087-
1. Let |a| be |c| &amp; 0x3FF.
6088-
1. Let |b| be |d| &amp; 0x3FF.
6089-
1. Append to |U| the Unicode character with
6090-
code point 2<sup>16</sup>+2<sup>10</sup>|a|+|b|.
6091-
1. Set |i| to |i|+1.
6092-
1. Otherwise, |d| &lt; 0xDC00 or |d| &gt; 0xDFFF.
6093-
Append to |U| a <span class="char">U+FFFD REPLACEMENT CHARACTER</span>.
6094-
</ol>
6095-
</dl>
6096-
1. Set |i| to |i|+1.
6097-
1. Return |U|.
6098-
</div>
6099-
61006063
There is no way to represent a constant {{DOMString}}
61016064
value in IDL, although {{DOMString}} [=dictionary member=] [=dictionary member/default values=]
61026065
and [=optional argument|operation optional argument=] [=optional argument/default values=]
@@ -7674,7 +7637,7 @@ value when its bit pattern is interpreted as an unsigned 64 bit integer.
76747637
1. Let |string| be the result of [=converted to an IDL value|converting=] |V|
76757638
to a {{DOMString}}.
76767639
1. Return an IDL {{USVString}} value that is the result of
7677-
[=obtain Unicode|converting=] |string| to a sequence of [=Unicode scalar values=].
7640+
[=string/convert|converting=] |string| to a sequence of [=Unicode scalar values=].
76787641
</div>
76797642

76807643
<div id="USVString-to-es" algorithm="convert an USVString to an ECMAScript value">
@@ -14286,7 +14249,7 @@ Note: as discussed in [[#es-DOMException-specialness]], the ECMAScript binding i
1428614249
requirements beyond the normal ones for [=interface types=].
1428714250

1428814251
Each {{DOMException}} object has an associated <dfn for="DOMException">name</dfn> and
14289-
<dfn for="DOMException">message</dfn>, both [=JavaScript strings=].
14252+
<dfn for="DOMException">message</dfn>, both [=strings=].
1429014253

1429114254
The <dfn constructor for="DOMException"><code>DOMException(|message|, |name|)</code></dfn>
1429214255
constructor, when invoked, must run these steps:

0 commit comments

Comments
 (0)