You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[selectors-4] Per WG resolution, add the :unchecked pseudo-class. Fold :indeterminate into the same section, and give some host language guidance. #10746
<td>a user-input element E that meets, or doesn't, its data validity semantics
@@ -2809,42 +2806,64 @@ The Default-option Pseudo-class: '':default''</h4>
2809
2806
<h3 id="input-value-states">
2810
2807
Input Value States</h3>
2811
2808
2812
-
<h4 id="checked">
2813
-
The Selected-option Pseudo-class: '':checked''</h4>
2809
+
<h4 id="checked" oldids="indeterminate">
2810
+
The Selected-option Pseudo-classes: '':checked'', '':unchecked'', and '':indeterminate''</h4>
2811
+
2812
+
Radio and checkbox elements can be toggled by the user,
2813
+
and some menu items are “checked” when the user selects them.
2814
+
This state is reflected by the <dfn export>input value pseudo-classes</dfn>.
2814
2815
2815
-
Radio and checkbox elements can be toggled by the user.
2816
-
Some menu items are “checked” when the user selects them.
2817
2816
When such elements are toggled “on”
2818
2817
the <dfn id='checked-pseudo'>:checked</dfn> pseudo-class applies.
2819
2818
For example, [[HTML5]] defines that <a href="https://html.spec.whatwg.org/multipage/semantics-other.html#selector-checked">checked checkboxes, radio buttons, and selected <code><option></code> elements</a> match '':checked''.
2819
+
Similarly, when such elements are toggled “off”,
2820
+
the <dfn id='unchecked-pseudo'>:unchecked</dfn> pseudo-class applies.
2821
+
2822
+
If an element that <em>could</em> match '':checked'' or '':unchecked''
2823
+
is neither "on" nor "off",
2824
+
the <dfn id='indeterminate-pseudo'>:indeterminate</dfn> pseudo-class applies.
2825
+
'':indeterminate'' also matches elements which do not have a notion of being "checked",
2826
+
but whose "value" is still in an indeterminate state,
2827
+
such as a progress meter whose progress percentage is unknown.
2828
+
2829
+
These three pseudo-classes are mutually exclusive;
2830
+
an element can only match at most one of them at a time.
2831
+
(And might match none,
2832
+
if the concept of being "checked" doesn't apply to them.)
2833
+
If the "indeterminate" concept is not mutually exclusive
2834
+
with the "checked"/"unchecked" concept in a host language
2835
+
(for example, in HTML a checkbox's "indeterminate" state is a separate boolean
2836
+
from its "checked" state boolean),
2837
+
being indeterminate wins over being checked/unchecked
2838
+
for the purpose of matching these pseudo-classes.
2820
2839
2821
-
While the '':checked'' pseudo-class is dynamic in nature,
2822
-
and can altered by user action,
2823
-
since it can also be based on the presence of semantic attributes in the document
2824
-
(such as the <code>selected</code> and <code>checked</code> attributes in [[HTML5]]),
2825
-
it applies to all media.
2826
-
2827
-
<div class="example">
2828
-
An unchecked checkbox can be selected by using the negation
2829
-
pseudo-class:
2830
-
2831
-
<pre>input[type=checkbox]:not(:checked)</pre>
2840
+
<div class=example>
2841
+
For example, in HTML:
2842
+
2843
+
* Checkboxes match '':indeterminate''
2844
+
if their {{HTMLInputElement/indeterminate}} property is true;
2845
+
otherwise, they match '':checked'' or '':unchecked''
2846
+
depending on their {{HTMLInputElement/checked}} property.
2847
+
* Radio buttons match '':checked'' if their {{HTMLInputElement/checked}} property is true.
2848
+
Otherwise, they match '':unchecked'' if they're in a radio group
2849
+
that contains a '':checked'' radio button.
2850
+
Otherwise (their {{HTMLInputElement/checked}} property is false,
2851
+
but they're alone or in a radio group with no checked radio button),
2852
+
they match '':indeterminate''.
2853
+
* <{option}> elements within a <{select}>
2854
+
match '':checked'' or '':unchecked''
2855
+
depending on their {{HTMLOptionElement/selected}} property.
2856
+
(They're never '':indeterminate''.)
2857
+
* <{progress}> elements match '':indeterminate''
2858
+
if they lack a <code>value</code> attribute
2832
2859
</div>
2833
2860
2834
-
<h4 id="indeterminate">
2835
-
The Indeterminate-value Pseudo-class: '':indeterminate''</h4>
2836
-
2837
-
The <dfn id='indeterminate-pseudo'>:indeterminate</dfn> pseudo-class applies to UI elements whose
2838
-
value is in an indeterminate state.
2839
-
For example, radio and checkbox elements can be toggled between checked and unchecked states,
2840
-
but are sometimes in an indeterminate state, neither checked nor unchecked.
2841
-
Similarly a progress meter can be in an indeterminate state when the percent completion is unknown.
2842
-
For example, [[HTML5]] defines how <a href="https://html.spec.whatwg.org/multipage/semantics-other.html#selector-indeterminate">checkboxes</a> can be made to match '':indeterminate''.
2861
+
While the [=input value pseudo-classes=] are dynamic in nature,
2862
+
and can altered by user action,
2863
+
since they can also be based on the presence of semantic attributes in the document
2864
+
(such as the <code>selected</code> and <code>checked</code> attributes in [[HTML5]]),
2865
+
they apply to all media.
2843
2866
2844
-
Like the '':checked'' pseudo-class, '':indeterminate''
2845
-
applies to all media. Components of a radio-group initialized with no
2846
-
pre-selected choice, for example, would be '':indeterminate''
0 commit comments