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
Abstract: <a>Selectors</a> are patterns that match against elements in a tree, and as such form one of several technologies that can be used to select nodes in a document. Selectors have been optimized for use with HTML and XML, and are designed to be usable in performance-critical code. They are a core component of <abbr title="Cascading Style Sheets">CSS</abbr> (Cascading Style Sheets), which uses Selectors to bind style properties to elements in the document.
13
13
Abstract: Selectors Level 5 describes the selectors that already exist in [[!selectors-4]], and further introduces new selectors for CSS and other languages that may need them.
14
14
</pre>
15
+
15
16
<pre class="link-defaults">
16
17
spec:selectors-4; type:dfn; text:selector
18
+
spec:html; type:dfn; text:states set
17
19
</pre>
18
20
19
21
<h2 id="intro">
@@ -133,16 +135,24 @@ The local link pseudo-class '':local-link''</h3>
133
135
<h2 id="custom-state">
134
136
Exposing custom state: the '':state()'' pseudo-class</h2>
135
137
136
-
The <dfn selector>:state()</dfn> pseudo-class takes a case-sensitive argument
137
-
and matches custom elements whose exposed custom states include the argument.
138
+
The <dfn selector id="state-pseudo">:state( <<ident>> )</dfn> pseudo-class
139
+
matches [=custom elements=]
140
+
whose [=states set=] contains a string
141
+
that [=string/is=] the selector's argument's value.
138
142
139
-
The grammar of the '':state()'' pseudo-class is:
143
+
<!-- Using <<ident>>, rather than <<custom-ident>>,
144
+
to avoid excluding the CSS-wide keywords. -->
140
145
141
-
<pre class=prod>:state( <ident> )</pre>
146
+
Note: The "[=string/is=]" matching behavior compares strings by codepoint;
147
+
notably, it's case-sensitive.
148
+
So if "foo" is in the [=states set=], '':state(FOO)'' will <em>not</em> match.
142
149
143
150
The exact matching behavior of '':state()'' pseudo-class
144
151
is defined by the host language.
145
-
See <a href="https://html.spec.whatwg.org/multipage/custom-elements.html#custom-state-pseudo-class">HTML's definition</a>.
152
+
For clarity, the concepts explaining this pseudo-class
153
+
link to the HTML definition;
154
+
see <a href="https://html.spec.whatwg.org/multipage/custom-elements.html#custom-state-pseudo-class">HTML's definition</a> for more detail.
155
+
Other host languages must define how this pseudo-class matches.
0 commit comments