Skip to content

Commit 842c489

Browse files
committed
Add the :open and :closed pseudo-selectors
These pseudo-selectors are defined in CSS here: https://drafts.csswg.org/selectors-4/#open-state
1 parent e41f54e commit 842c489

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

source

+50
Original file line numberDiff line numberDiff line change
@@ -74232,6 +74232,56 @@ Demos:
7423274232
<dd><p>The <code data-x="selector-volume-locked">:volume-locked</code> <span>pseudo-class</span>
7423374233
must match all <span data-x="media element">media elements</span> when the user agent's
7423474234
<span>volume locked</span> is true.</p></dd>
74235+
74236+
<dt><dfn selector><code data-x="selector-open">:open</code></dfn></dt>
74237+
<dd>
74238+
<p>The <code data-x="selector-open">:open</code> <span>pseudo-class</span> must match any
74239+
element that <span>matches the open selector</span>.<p>
74240+
74241+
<p>To determine if an <code>Element</code> <var>element</var> <dfn>matches the open
74242+
selector</dfn>:</p>
74243+
74244+
<ol>
74245+
<li>
74246+
<p>If <var>element</var> is a <code>details</code> or <code>dialog</code> element:</p>
74247+
74248+
<ol>
74249+
<li><p>Return true if <var>element</var> has the <code data-x="attr-dialog-open">open</code>
74250+
attribute, otherwise false.</p></li>
74251+
</ol>
74252+
</li>
74253+
74254+
<li><p>If <var>element</var> is a <code>select</code> element and <var>element</var> is being
74255+
rendered as a button with a popup and the popup is open, then return true.</p></li>
74256+
74257+
<li><p>Return false.</p></li>
74258+
</ol>
74259+
</dd>
74260+
74261+
<dt><dfn selector><code data-x="selector-closed">:closed</code></dfn></dt>
74262+
<dd>
74263+
<p>The <code data-x="selector-closed">:closed</code> <span>pseudo-class</span> must match any
74264+
element that <span>matches the closed selector</span>.<p>
74265+
74266+
<p>To determine if an <code>Element</code> <var>element</var> <dfn>matches the closed
74267+
selector</dfn>:</p>
74268+
74269+
<ol>
74270+
<li>
74271+
<p>If <var>element</var> is a <code>details</code> or <code>dialog</code> element:</p>
74272+
74273+
<ol>
74274+
<li><p>Return false if <var>element</var> has the <code data-x="attr-dialog-open">open</code>
74275+
attribute, otherwise true.</p></li>
74276+
</ol>
74277+
</li>
74278+
74279+
<li><p>If <var>element</var> is a <code>select</code> element and <var>element</var> is being
74280+
rendered as a button with a popup and the popup is closed, then return true.</p></li>
74281+
74282+
<li><p>Return false.</p></li>
74283+
</ol>
74284+
</dd>
7423574285
</dl>
7423674286

7423774287
<p class="note">This specification does not define when an element matches the <code undefined

0 commit comments

Comments
 (0)