@@ -2481,6 +2481,29 @@ Sound State: the '':muted'' and '':volume-locked'' pseudo-classes
2481
2481
2482
2482
Element Display State Pseudo-classes
2483
2483
2484
+
2485
+ Collapse State: the '':open'' and '':closed'' pseudo-class
2486
+
2487
+ The :open pseudo-class represents an element
2488
+ that has both “open” and “closed” states,
2489
+ and which is currently in the “open” state.
2490
+
2491
+ The :closed pseudo-class represents an element
2492
+ that has both “open” and “closed” states,
2493
+ and which is currently in the closed state.
2494
+
2495
+ Exactly what “open” and “closed” mean is host-language specific,
2496
+ but exemplified by elements such as
2497
+ HTML's <{details}> , <{select}> , and <{dialog}> elements,
2498
+ all of which can be toggled “open” to display more content
2499
+ (or any content at all, in the case of <{dialog}> ).
2500
+
2501
+ Note: Being “open” or “closed” is a semantic state.
2502
+ An element not currently being displayed
2503
+ (for example, one that has ''visibility: collapse'' ,
2504
+ or belongs to a ''display: none'' subtree)
2505
+ can still be “open” and will match '':open'' .
2506
+
2484
2507
2485
2508
Modal (Exclusive Interaction) State: the '':modal'' pseudo-class
2486
2509
@@ -4007,6 +4030,8 @@ Changes since the 7 May 2022 Working Draft
4007
4030
4008
4031
Significant changes since the
7 May 2022 Working Draft :
4009
4032
4033
+ * Added '':open'' and '':closed'' pseudo-classes.
4034
+
4010
4035
* Disallowed [=pseudo-elements=] from '':has()'' unless explicitly allowed
4011
4036
by the pseudo-element’s definition.
4012
4037
0 commit comments