Skip to content

Commit 4c018c6

Browse files
authored
Editorial: define the string types in terms of Infra types
Closes #335.
1 parent a35410d commit 4c018c6

File tree

1 file changed

+20
-25
lines changed

1 file changed

+20
-25
lines changed

index.bs

Lines changed: 20 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ Complain About: accidental-2119 no
1111
</pre>
1212

1313
<pre class="link-defaults">
14-
spec: infra; type: dfn; text: list
14+
spec: infra; type: dfn;
15+
text: code unit
16+
text: list
1517
spec: ecmascript; type: dfn;
1618
for: ECMAScript;
1719
text: constructor
@@ -2095,17 +2097,15 @@ the value is the IDL {{undefined}} value.
20952097
1. Depending on the type of the argument:
20962098
<dl class="switch">
20972099
: {{DOMString}}
2100+
: {{USVString}}
20982101
: an [=enumeration=] type
20992102
:: The value of the <emu-t class="regex"><a href="#prod-string">string</a></emu-t> token
2100-
is the sequence of 16 bit unsigned integer code units
2101-
(hereafter referred to just as <dfn id="dfn-code-unit">code units</dfn>)
2102-
corresponding to the UTF-16 encoding of |S|.
2103+
is |S|.
21032104
: {{ByteString}}
2104-
:: The value of the <emu-t class="regex"><a href="#prod-string">string</a></emu-t> token
2105-
is the sequence of 8 bit unsigned integer code units
2106-
corresponding to the UTF-8 encoding of |S|.
2107-
: {{USVString}}
2108-
:: The value of the <emu-t class="regex"><a href="#prod-string">string</a></emu-t> token is |S|.
2105+
:: Assert: |S| doesn't contain any [=code points=] higher than U+00FF.
2106+
2107+
The value of the <emu-t class="regex"><a href="#prod-string">string</a></emu-t> token
2108+
is the [=isomorphic encoding=] of |S|.
21092109
</dl>
21102110
</div>
21112111

@@ -5436,7 +5436,8 @@ allows authors to register callbacks by providing objects that implement the
54365436

54375437
<h3 id="idl-types">Types</h3>
54385438

5439-
This section lists the types supported by Web IDL, the set of values
5439+
This section lists the types supported by Web IDL,
5440+
the set of values or [[Infra|Infra]] type
54405441
corresponding to each type, and how [=constants=]
54415442
of that type are represented.
54425443

@@ -5791,10 +5792,7 @@ The {{bigint}} type is an arbitrary integer type, unrestricted in range.
57915792

57925793
<h4 oldids="dom-DOMString" id="idl-DOMString" interface>DOMString</h4>
57935794

5794-
The {{DOMString}} type corresponds to
5795-
the set of all possible sequences of [=code units=].
5796-
Such sequences are commonly interpreted as UTF-16 encoded strings [[!RFC2781]]
5797-
although this is not required.
5795+
The {{DOMString}} type corresponds to [=strings=].
57985796

57995797
Note: Note also that <emu-val>null</emu-val>
58005798
is not a value of type {{DOMString}}.
@@ -5818,7 +5816,7 @@ can be set to [=value of string literal tokens|the value=] of a
58185816
<h4 oldids="dom-ByteString" id="idl-ByteString" interface>ByteString</h4>
58195817

58205818
The {{ByteString}} type
5821-
corresponds to the set of all possible sequences of bytes.
5819+
corresponds to [=byte sequences=].
58225820
Such sequences might be interpreted as UTF-8 encoded strings [[!RFC3629]]
58235821
or strings in some other 8-bit-per-code-unit encoding, although this is not required.
58245822

@@ -5845,10 +5843,10 @@ can be set to [=value of string literal tokens|the value=] of a
58455843
<h4 oldids="dom-USVString" id="idl-USVString" interface>USVString</h4>
58465844

58475845
The {{USVString}} type
5848-
corresponds to the set of all possible sequences of
5849-
[=scalar values=],
5850-
which are all of the Unicode code points apart from the
5851-
surrogate code points.
5846+
corresponds to [=scalar value strings=].
5847+
Depending on the context,
5848+
these can be treated as sequences of either 16-bit unsigned integer [=code units=]
5849+
or [=scalar values=].
58525850

58535851
There is no way to represent a constant {{USVString}}
58545852
value in IDL, although {{USVString}} [=dictionary member=] [=dictionary member/default values=]
@@ -7471,12 +7469,9 @@ value when its bit pattern is interpreted as an unsigned 64 bit integer.
74717469

74727470
<div id="USVString-to-es" algorithm="convert an USVString to an ECMAScript value">
74737471

7474-
An IDL {{USVString}} value is [=converted to an ECMAScript value|converted=]
7475-
to an ECMAScript value by running the following algorithm:
7476-
7477-
1. Let |scalarValues| be the sequence of [=scalar values=] the {{USVString}} represents.
7478-
1. Let |string| be the sequence of [=code units=] that results from encoding |scalarValues| in UTF-16.
7479-
1. Return the String value that represents the same sequence of [=code units=] as |string|.
7472+
The result of [=converted to an ECMAScript value|converting=]
7473+
an IDL {{USVString}} value |S| to an ECMAScript
7474+
value is |S|.
74807475
</div>
74817476

74827477

0 commit comments

Comments
 (0)