Skip to content

Commit e63d98e

Browse files
committed
Clarify CORS attribute reflection
Notably, this renames "canonical case" to "canonical keyword", and defines exactly how it is used. Closes #3685. This also rearranges the CORS settings attribute definition a bit to match other enumerated attributes more closely.
1 parent 80e087c commit e63d98e

File tree

1 file changed

+30
-24
lines changed

1 file changed

+30
-24
lines changed

source

Lines changed: 30 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7025,38 +7025,40 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
70257025
<h4>CORS settings attributes</h4>
70267026

70277027
<p>A <dfn>CORS settings attribute</dfn> is an <span>enumerated attribute</span>. The following
7028-
table lists the keywords and states for the attribute &mdash; the keywords in the left column map
7029-
to the states in the cell in the second column on the same row as the keyword.</p>
7028+
table lists the keywords and states for the attribute &mdash; the states given in the first cell
7029+
of the rows with keywords give the states to which those keywords map.</p>
70307030

70317031
<table>
70327032
<thead>
70337033
<tr>
7034-
<th> Keyword
70357034
<th> State
7035+
<th> Keywords
70367036
<th> Brief description
70377037
<tbody>
70387038
<tr>
7039+
<td rowspan=2><dfn data-x="attr-crossorigin-anonymous">Anonymous</dfn>
70397040
<td><dfn><code data-x="attr-crossorigin-anonymous-keyword">anonymous</code></dfn>
7040-
<td><dfn data-x="attr-crossorigin-anonymous">Anonymous</dfn>
7041-
<td><span data-x="concept-request">Requests</span> for the element will have their <span
7042-
data-x="concept-request-mode">mode</span> set to "<code data-x="">cors</code>" and their <span
7043-
data-x="concept-request-credentials-mode">credentials mode</span> set to "<code
7041+
<td rowspan=2><span data-x="concept-request">Requests</span> for the element will have their
7042+
<span data-x="concept-request-mode">mode</span> set to "<code data-x="">cors</code>" and their
7043+
<span data-x="concept-request-credentials-mode">credentials mode</span> set to "<code
70447044
data-x="">same-origin</code>".
70457045
<tr>
7046-
<td><dfn><code data-x="attr-crossorigin-use-credentials-keyword">use-credentials</code></dfn>
7046+
<td>(the empty string)
7047+
<tr>
70477048
<td><dfn data-x="attr-crossorigin-use-credentials">Use Credentials</dfn>
7049+
<td><dfn><code data-x="attr-crossorigin-use-credentials-keyword">use-credentials</code></dfn>
70487050
<td><span data-x="concept-request">Requests</span> for the element will have their <span
70497051
data-x="concept-request-mode">mode</span> set to "<code data-x="">cors</code>" and their <span
70507052
data-x="concept-request-credentials-mode">credentials mode</span> set to "<code
70517053
data-x="">include</code>".
70527054
</table>
70537055

7054-
<p>The empty string is also a valid keyword, and maps to the <span
7055-
data-x="attr-crossorigin-anonymous">Anonymous</span> state. The attribute's <i data-x="invalid value default">invalid value default</i> is the <span data-x="attr-crossorigin-anonymous">Anonymous</span> state. For the
7056-
purposes of <span data-x="reflect">reflection</span>, the canonical case for the <span
7057-
data-x="attr-crossorigin-anonymous">Anonymous</span> state is the <code
7058-
data-x="attr-crossorigin-anonymous-keyword">anonymous</code> keyword. The <i data-x="missing value default">missing value default</i>, used when the attribute is omitted, is the <dfn data-x="attr-crossorigin-none">No
7059-
CORS</dfn> state.</p>
7056+
<p>The attribute's <i data-x="invalid value default">invalid value default</i> is the <span
7057+
data-x="attr-crossorigin-anonymous">Anonymous</span> state, and its <i data-x="missing value
7058+
default">missing value default</i> is the <dfn data-x="attr-crossorigin-none">No CORS</dfn> state.
7059+
For the purposes of <span data-x="reflect">reflection</span>, the <span>canonical keyword</span>
7060+
for the <span data-x="attr-crossorigin-anonymous">Anonymous</span> state is the <code
7061+
data-x="attr-crossorigin-anonymous-keyword">anonymous</code> keyword.</p>
70607062

70617063
<p>The majority of fetches governed by <span data-x="CORS settings attribute">CORS settings
70627064
attributes</span> will be done via the <span>create a potential-CORS request</span> algorithm.</p>
@@ -7266,19 +7268,23 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
72667268
<p>If a reflecting IDL attribute is a <code data-x="idl-DOMString">DOMString</code> attribute
72677269
whose content attribute is an <span>enumerated attribute</span>, and the IDL attribute is
72687270
<dfn>limited to only known values</dfn>, then, on getting, the IDL attribute must return the
7269-
conforming value associated with the state the attribute is in (in its canonical case), if any, or
7270-
the empty string if the attribute is in a state that has no associated keyword value or if the
7271-
attribute is not in a defined state (e.g. the attribute is missing and there is no <i
7272-
data-x="missing value default">missing value default</i>). On setting, the content attribute must
7273-
be set to the specified new value.</p>
7271+
keyword value associated with the state the attribute is in, if any, or the empty string if the
7272+
attribute is in a state that has no associated keyword value or if the attribute is not in a
7273+
defined state (e.g. the attribute is missing and there is no <i data-x="missing value
7274+
default">missing value default</i>). If there are multiple keyword values for the state, then
7275+
return the conforming one. If there are multiple conforming keyword values, then one will be
7276+
designated the <dfn>canonical keyword</dfn>; choose that one. On setting, the content attribute
7277+
must be set to the specified new value.</p>
72747278

72757279
<p>If a reflecting IDL attribute is a nullable <code data-x="idl-DOMString">DOMString</code>
72767280
attribute whose content attribute is an <span>enumerated attribute</span>, then, on getting, if
7277-
the corresponding content attribute is in its <i>missing value default</i> then the IDL attribute
7278-
must return null, otherwise, the IDL attribute must return the conforming value associated with
7279-
the state the attribute is in (in its canonical case). On setting, if the new value is null, the
7280-
content attribute must be removed, and otherwise, the content attribute must be set to the
7281-
specified new value.</p>
7281+
the corresponding content attribute is in its <i>missing value default</i> state then the IDL
7282+
attribute must return null, otherwise, the IDL attribute must return the keyword value associated
7283+
with the state the attribute is in. If there are multiple keyword values for the state, then
7284+
return the conforming one. If there are multiple conforming keyword values, then one will be
7285+
designated the <span>canonical keyword</span>; choose that one. On setting, if the new value is
7286+
null, the content attribute must be removed, and otherwise, the content attribute must be set to
7287+
the specified new value.</p>
72827288

72837289
<p>If a reflecting IDL attribute is a <code data-x="idl-DOMString">DOMString</code> or <code
72847290
data-x="idl-USVString">USVString</code> attribute but doesn't fall into any of the above

0 commit comments

Comments
 (0)