Skip to content

Commit 87607ab

Browse files
committed
[selectors-4][editorial] Clarify the expected rules for :blank, matching what HTML is expected to specify. w3c#8220
1 parent 725b3e8 commit 87607ab

File tree

1 file changed

+19
-9
lines changed

1 file changed

+19
-9
lines changed

selectors-4/Overview.bs

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2743,15 +2743,25 @@ The Empty-Value Pseudo-class: '':blank''</h4>
27432743
applies to user-input elements whose input value is empty
27442744
(consists of the empty string or otherwise null input).
27452745

2746-
<div class="example">
2747-
Examples of '':blank'' user-input elements would be
2748-
a <{textarea}> element whose contents are empty,
2749-
or an <{input}> field whose value is empty.
2750-
Note that the value under consideration here is the value
2751-
that would be submitted
2752-
(see <a href="https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#a-form-control's-value">A form control’s value</a> in [[HTML]]),
2753-
which in HTML does not necessarily correspond to the value
2754-
of the element’s <{input/value}> attribute.
2746+
<div class="note">
2747+
Roughly speaking, if a human looked at a printout of the form
2748+
and would say it’s blank,
2749+
it matches '':blank''.
2750+
2751+
A rule of thumb for interpreting '':blank'' on form controls is:
2752+
2753+
* If the control always submits,
2754+
and would do so with an empty string, it matches '':blank''.
2755+
(Such as HTML’s <code>&lt;input type=text></code> when its value is empty.)
2756+
* If it sometimes submits, and is set to not submit, it matches '':blank''.
2757+
(Such as HTML’s <code>&lt;input type=checkbox></code> when not checked.)
2758+
* If it's an “action button”
2759+
(rather than a “toggle button” that represents a state)
2760+
such as <code>&lt;button></code>, <code>&lt;input type=submit></code>, etc.,
2761+
it never matches '':blank''.
2762+
2763+
Host languages can specify more precise rules
2764+
for when form controls match '':blank''.
27552765
</div>
27562766

27572767
Note: This selector is at-risk.

0 commit comments

Comments
 (0)