Skip to content

Commit 07cc083

Browse files
authored
Introduce an explicit empty value default state
This replaces the use of the empty string as a keyword. Fixes #11451.
1 parent e774e8e commit 07cc083

File tree

1 file changed

+58
-59
lines changed

1 file changed

+58
-59
lines changed

source

Lines changed: 58 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -5187,17 +5187,13 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
51875187

51885188
<p>Some attributes, called <dfn data-x="enumerated attribute" data-lt="enumerated attribute"
51895189
export>enumerated attributes</dfn>, take on a finite set of states. The state for such an
5190-
attribute is derived by combining the attribute's value, a set of keyword/state mappings given in
5191-
the specification of each attribute, and two possible special states that can also be given in the
5192-
specification of the attribute. These special states are the <dfn><i>invalid value
5193-
default</i></dfn> and the <dfn><i>missing value default</i></dfn>.</p>
5190+
attribute is derived by combining the attribute's value, a set of keyword/state mappings, and
5191+
three possible special states that can also be given in the specification of the attribute. These
5192+
special states are the <dfn><i>invalid value default</i></dfn>, the <dfn><i>missing value
5193+
default</i></dfn>, and the <dfn><i>empty value default</i></dfn>.</p>
51945194

51955195
<p class="note">Multiple keywords can map to the same state.</p>
51965196

5197-
<p class="note">The empty string can be a valid keyword. Note that the <i data-x="missing value
5198-
default">missing value default</i> applies only when the attribute is <em>missing</em>, not when
5199-
it is present with an empty string value.</p>
5200-
52015197
<p>To determine the state of an attribute, use the following steps:</p>
52025198

52035199
<ol>
@@ -5216,6 +5212,10 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
52165212
<li><p>If the attribute's value is an <span>ASCII case-insensitive</span> match for one of the
52175213
keywords defined for the attribute, then return the state represented by that keyword.</p></li>
52185214

5215+
<li><p>If the attribute has an <i data-x="empty value default">empty value default</i> state
5216+
defined and the attribute's value is the empty string, then return that <i data-x="empty value
5217+
default">empty value default</i> state.</p></li>
5218+
52195219
<li><p>If the attribute has an <i data-x="invalid value default">invalid value default</i> state
52205220
defined, then return that <i data-x="invalid value default">invalid value default</i>
52215221
state.</p></li>
@@ -5224,8 +5224,14 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
52245224
</ol>
52255225

52265226
<p>For authoring conformance purposes, if an enumerated attribute is specified, the attribute's
5227-
value must be an <span>ASCII case-insensitive</span> match for one of the conforming keywords for
5228-
that attribute, with no leading or trailing whitespace.</p>
5227+
value must be one of:</p>
5228+
5229+
<ul>
5230+
<li><p>An <span>ASCII case-insensitive</span> match for one of the conforming keywords for that
5231+
attribute, with no leading or trailing whitespace.</p></li>
5232+
<li><p>The empty string and the attribute must have an <i data-x="empty value default">empty
5233+
value default</i> defined.</p></li>
5234+
</ul>
52295235

52305236
<p>For <span data-x="reflect">reflection</span> purposes, states which have any keywords mapping
52315237
to them are said to have a <dfn>canonical keyword</dfn>. This is determined as follows:</p>
@@ -7625,13 +7631,11 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
76257631
<tbody>
76267632
<tr>
76277633
<td><dfn attr-value for="audio/crossorigin,video/crossorigin,img/crossorigin,link/crossorigin,script/crossorigin"><code data-x="attr-crossorigin-anonymous-keyword">anonymous</code></dfn>
7628-
<td rowspan=2><dfn data-x="attr-crossorigin-anonymous">Anonymous</dfn>
7629-
<td rowspan=2><span data-x="concept-request">Requests</span> for the element will have their
7634+
<td><dfn data-x="attr-crossorigin-anonymous">Anonymous</dfn>
7635+
<td><span data-x="concept-request">Requests</span> for the element will have their
76307636
<span data-x="concept-request-mode">mode</span> set to "<code data-x="">cors</code>" and their
76317637
<span data-x="concept-request-credentials-mode">credentials mode</span> set to "<code
76327638
data-x="">same-origin</code>".
7633-
<tr>
7634-
<td>(the empty string)
76357639
<tr>
76367640
<td><dfn attr-value for="audio/crossorigin,video/crossorigin,img/crossorigin,link/crossorigin,script/crossorigin"><code data-x="attr-crossorigin-use-credentials-keyword">use-credentials</code></dfn>
76377641
<td><dfn data-x="attr-crossorigin-use-credentials">Use Credentials</dfn>
@@ -7643,8 +7647,8 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
76437647

76447648
<p>The attribute's <i data-x="missing value default">missing value default</i> is the <dfn
76457649
data-x="attr-crossorigin-none">No CORS</dfn> state, and its <i data-x="invalid value
7646-
default">invalid value default</i> is the <span
7647-
data-x="attr-crossorigin-anonymous">Anonymous</span> state.</p>
7650+
default">invalid value default</i> and <i data-x="empty value default">empty value default</i> are
7651+
both the <span data-x="attr-crossorigin-anonymous">Anonymous</span> state.</p>
76487652

76497653
<p>The majority of fetches governed by <span data-x="CORS settings attribute">CORS settings
76507654
attributes</span> will be done via the <span>create a potential-CORS request</span> algorithm.</p>
@@ -13890,10 +13894,8 @@ Transport Protocol">HTTP&lt;/abbr> today.&lt;/p></code></pre> <!-- DO NOT REWRAP
1389013894
<tr>
1389113895
<td><dfn attr-value for="html-global/translate"><code
1389213896
data-x="attr-translate-yes-keyword">yes</code></dfn>
13893-
<td rowspan=2><dfn data-x="attr-translate-yes-state">Yes</dfn>
13894-
<td rowspan=2>Sets <span>translation mode</span> to <span>translate-enabled</span>.
13895-
<tr>
13896-
<td>(the empty string)
13897+
<td><dfn data-x="attr-translate-yes-state">Yes</dfn>
13898+
<td>Sets <span>translation mode</span> to <span>translate-enabled</span>.
1389713899
<tr>
1389813900
<td><dfn attr-value for="html-global/translate"><code
1389913901
data-x="attr-translate-no-keyword">no</code></dfn>
@@ -13903,7 +13905,9 @@ Transport Protocol">HTTP&lt;/abbr> today.&lt;/p></code></pre> <!-- DO NOT REWRAP
1390313905

1390413906
<p>The attribute's <i data-x="missing value default">missing value default</i> and <i
1390513907
data-x="invalid value default">invalid value default</i> are both the <dfn
13906-
data-x="attr-translate-inherit-state">Inherit</dfn> state.</p>
13908+
data-x="attr-translate-inherit-state">Inherit</dfn> state, and its <i data-x="empty value
13909+
default">empty value default</i> is the <span data-x="attr-translate-yes-state">Yes</span>
13910+
state.</p>
1390713911

1390813912
<p>Each element (even non-HTML elements) has a <dfn>translation mode</dfn>, which is in either the
1390913913
<span>translate-enabled</span> state or the <span>no-translate</span> state. If an <span
@@ -37731,10 +37735,8 @@ interface <dfn interface>MediaError</dfn> {
3773137735
<tr>
3773237736
<td><dfn attr-value for="audio/preload,video/preload"><code
3773337737
data-x="attr-media-preload-auto">auto</code></dfn>
37734-
<td rowspan=2><dfn data-x="attr-media-preload-auto-state">Automatic</dfn>
37735-
<td rowspan=2>Hints to the user agent that the user agent can put the user's needs first without risk to the server, up to and including optimistically downloading the entire resource.
37736-
<tr>
37737-
<td>(the empty string)
37738+
<td><dfn data-x="attr-media-preload-auto-state">Automatic</dfn>
37739+
<td>Hints to the user agent that the user agent can put the user's needs first without risk to the server, up to and including optimistically downloading the entire resource.
3773837740
<tr>
3773937741
<td><dfn attr-value for="audio/preload,video/preload"><code
3774037742
data-x="attr-media-preload-none">none</code></dfn>
@@ -37749,6 +37751,9 @@ interface <dfn interface>MediaError</dfn> {
3774937751
When the media resource is playing, hints to the user agent that bandwidth is to be considered scarce, e.g. suggesting throttling the download so that the media data is obtained at the slowest possible rate that still maintains consistent playback.
3775037752
</table>
3775137753

37754+
<p>The attribute's <i data-x="empty value default">empty value default</i> is the <span
37755+
data-x="attr-media-preload-auto-state">Automatic</span> state.</p>
37756+
3775237757
<p>The attribute's <i data-x="missing value default">missing value default</i> and <i
3775337758
data-x="invalid value default">invalid value default</i> are both
3775437759
<span>implementation-defined</span>, though the <span
@@ -80348,10 +80353,8 @@ END:VCARD</pre>
8034880353
<tbody>
8034980354
<tr>
8035080355
<td><dfn attr-value for="html-global/hidden"><code data-x="attr-hidden-hidden">hidden</code></dfn>
80351-
<td rowspan=2><dfn data-x="attr-hidden-hidden-state">Hidden</dfn>
80352-
<td rowspan=2>Will not be rendered.
80353-
<tr>
80354-
<td>(the empty string)
80356+
<td><dfn data-x="attr-hidden-hidden-state">Hidden</dfn>
80357+
<td>Will not be rendered.
8035580358
<tr>
8035680359
<td><dfn attr-value for="html-global/hidden"><code data-x="attr-hidden-until-found">until-found</code></dfn>
8035780360
<td><dfn data-x="attr-hidden-until-found-state">Hidden Until Found</dfn>
@@ -80361,8 +80364,8 @@ END:VCARD</pre>
8036180364

8036280365
<p>The attribute's <i data-x="missing value default">missing value default</i> is the <dfn
8036380366
data-x="attr-hidden-not-hidden-state">Not Hidden</dfn> state, and its <i data-x="invalid value
80364-
default">invalid value default</i> is the <span data-x="attr-hidden-hidden-state">Hidden</span>
80365-
state.</p>
80367+
default">invalid value default</i> and <i data-x="empty value default">empty value default</i> are
80368+
both the <span data-x="attr-hidden-hidden-state">Hidden</span> state.</p>
8036680369

8036780370
<p>When an element has the <code data-x="attr-hidden">hidden</code> attribute in the <span
8036880371
data-x="attr-hidden-hidden-state">Hidden</span> state, it indicates that the element is not yet, or
@@ -83359,10 +83362,8 @@ addShortcutKeyLabel(document.getElementById('c'));</code></pre>
8335983362
<tr>
8336083363
<td><dfn attr-value for="html-global/contenteditable"><code
8336183364
data-x="attr-contenteditable-true">true</code></dfn>
83362-
<td rowspan=2><dfn data-x="attr-contenteditable-true-state">True</dfn>
83363-
<td rowspan=2>The element is editable.
83364-
<tr>
83365-
<td>(the empty string)
83365+
<td><dfn data-x="attr-contenteditable-true-state">True</dfn>
83366+
<td>The element is editable.
8336683367
<tr>
8336783368
<td><dfn attr-value for="html-global/contenteditable"><code
8336883369
data-x="attr-contenteditable-false">false</code></dfn>
@@ -83379,7 +83380,9 @@ addShortcutKeyLabel(document.getElementById('c'));</code></pre>
8337983380
<p>The attribute's <i data-x="missing value default">missing value default</i> and <i
8338083381
data-x="invalid value default">invalid value default</i> are both the <dfn
8338183382
data-x="attr-contenteditable-inherit-state">Inherit</dfn> state. The inherit state indicates that
83382-
the element is editable (or not) based on the parent element's state.</p>
83383+
the element is editable (or not) based on the parent element's state. The attribute's <i
83384+
data-x="empty value default">empty value default</i> is the <span
83385+
data-x="attr-contenteditable-true-state">True</span> state.</p>
8338383386

8338483387
<div class="example">
8338583388
<p>For example, consider a page that has a <code>form</code> and a <code>textarea</code> to
@@ -83647,10 +83650,8 @@ body { display:none }
8364783650
<tr>
8364883651
<td><dfn attr-value for="html-global/spellcheck"><code
8364983652
data-x="attr-spellcheck-true">true</code></dfn>
83650-
<td rowspan=2><dfn data-x="attr-spellcheck-true-state">True</dfn>
83651-
<td rowspan=2>Spelling and grammar will be checked.
83652-
<tr>
83653-
<td>(the empty string)
83653+
<td><dfn data-x="attr-spellcheck-true-state">True</dfn>
83654+
<td>Spelling and grammar will be checked.
8365483655
<tr>
8365583656
<td><dfn attr-value for="html-global/spellcheck"><code
8365683657
data-x="attr-spellcheck-false">false</code></dfn>
@@ -83662,7 +83663,9 @@ body { display:none }
8366283663
data-x="invalid value default">invalid value default</i> are both the <dfn
8366383664
data-x="attr-spellcheck-default-state">Default</dfn> state. The default state indicates that the
8366483665
element is to act according to a default behavior, possibly based on the parent element's own
83665-
<code data-x="attr-spellcheck">spellcheck</code> state, as defined below.</p>
83666+
<code data-x="attr-spellcheck">spellcheck</code> state, as defined below. The attribute's <i
83667+
data-x="empty value default">empty value default</i> is the <span
83668+
data-x="attr-spellcheck-true-state">True</span> state.</p>
8366683669

8366783670
<div w-nodev>
8366883671

@@ -83839,11 +83842,9 @@ body { display:none }
8383983842
<tr>
8384083843
<td><dfn attr-value for="html-global/writingsuggestions"><code
8384183844
data-x="attr-writingsuggestions-true">true</code></dfn>
83842-
<td rowspan="2"><dfn data-x="attr-writingsuggestions-true-state">True</dfn>
83843-
<td rowspan="2">Writing suggestions should be offered on this element.
83845+
<td><dfn data-x="attr-writingsuggestions-true-state">True</dfn>
83846+
<td>Writing suggestions should be offered on this element.
8384483847
</tr>
83845-
<tr>
83846-
<td>(the empty string)
8384783848
<tr>
8384883849
<td><dfn attr-value for="html-global/writingsuggestions"><code
8384983850
data-x="attr-writingsuggestions-false">false</code></dfn>
@@ -83858,7 +83859,8 @@ body { display:none }
8385883859
element's own <code data-x="attr-writingsuggestions">writingsuggestions</code> state, as defined
8385983860
below.</p>
8386083861

83861-
<p>The attribute's <i data-x="invalid value default">invalid value default</i> is the <span
83862+
<p>The attribute's <i data-x="invalid value default">invalid value default</i> and <i
83863+
data-x="empty value default">empty value default</i> are both the <span
8386283864
data-x="attr-writingsuggestions-true-state">True</span> state.</p>
8386383865

8386483866
<dl class="domintro">
@@ -84190,21 +84192,19 @@ body { display:none }
8419084192
<tr>
8419184193
<td><dfn attr-value for="html-global/autocorrect"><code
8419284194
data-x="attr-autocorrect-on">on</code></dfn>
84193-
<td rowspan="2"><dfn data-x="concept-autocorrection-on">on</dfn>
84194-
<td rowspan="2">The user agent is permitted to automatically correct spelling errors while the user types.
84195+
<td><dfn data-x="concept-autocorrection-on">on</dfn>
84196+
<td>The user agent is permitted to automatically correct spelling errors while the user types.
8419584197
Whether spelling is automatically corrected while typing left is for the user agent to decide,
8419684198
and may depend on the element as well as the user's preferences.
84197-
<tr>
84198-
<td>(the empty string)
8419984199
<tr>
8420084200
<td><dfn attr-value for="html-global/autocorrect"><code data-x="attr-autocorrect-off">off</code></dfn>
8420184201
<td><dfn data-x="concept-autocorrection-off">off</dfn>
8420284202
<td>The user agent is not allowed to automatically correct spelling while the user types.
8420384203
</table>
8420484204

84205-
<p>The attribute's <i data-x="invalid value default">invalid value default</i> and <i
84206-
data-x="missing value default">missing value default</i> are both the <span
84207-
data-x="concept-autocorrection-on">on</span> state.</p>
84205+
<p>The attribute's <i data-x="invalid value default">invalid value default</i>, <i data-x="missing
84206+
value default">missing value default</i>, and <i data-x="empty value default">empty value
84207+
default</i> are all the <span data-x="concept-autocorrection-on">on</span> state.</p>
8420884208

8420984209
<p>The <dfn attribute for="HTMLElement"><code data-x="dom-autocorrect">autocorrect</code></dfn>
8421084210
getter steps are: return true if the element's <span>used autocorrection state</span> is <span
@@ -87367,11 +87367,9 @@ dictionary <dfn dictionary>DragEventInit</dfn> : <span>MouseEventInit</span> {
8736787367
<tr>
8736887368
<td><dfn attr-value for="html-global/popover"><code
8736987369
data-x="attr-popover-auto">auto</code></dfn>
87370-
<td rowspan=2><dfn data-x="attr-popover-auto-state">Auto</dfn>
87371-
<td rowspan=2>Closes other popovers when opened; has <span data-x="popover light dismiss">light
87370+
<td><dfn data-x="attr-popover-auto-state">Auto</dfn>
87371+
<td>Closes other popovers when opened; has <span data-x="popover light dismiss">light
8737287372
dismiss</span> and responds to <span data-x="close request">close requests</span>.
87373-
<tr>
87374-
<td>(the empty string)
8737587373
<tr>
8737687374
<td><dfn attr-value for="html-global/popover"><code
8737787375
data-x="attr-popover-manual">manual</code></dfn>
@@ -87391,9 +87389,10 @@ dictionary <dfn dictionary>DragEventInit</dfn> : <span>MouseEventInit</span> {
8739187389
</table>
8739287390

8739387391
<p>The attribute's <i data-x="missing value default">missing value default</i> is the <dfn
87394-
data-x="attr-popover-none-state">No Popover</dfn> state, and its <i data-x="invalid value
87392+
data-x="attr-popover-none-state">No Popover</dfn> state, its <i data-x="invalid value
8739587393
default">invalid value default</i> is the <span data-x="attr-popover-manual-state">Manual</span>
87396-
state.</p>
87394+
state, and its <i data-x="empty value default">empty value default</i> is the <span
87395+
data-x="attr-popover-auto-state">Auto</span> state.</p>
8739787396

8739887397
<p>The <dfn attribute for="HTMLElement"><code data-x="dom-popover">popover</code></dfn> IDL
8739987398
attribute must <span>reflect</span> the <span data-x="attr-popover">popover</span> attribute,

0 commit comments

Comments
 (0)