Skip to content

Commit baced94

Browse files
committed
[selectors-5][editorial] Light rewrite of :state() definition.
1 parent 6b91e79 commit baced94

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

selectors-5/Overview.bs

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@ Editor: Tab Atkins Jr., Google, http://xanthir.com/contact/, w3cid 42199
1212
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.
1313
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.
1414
</pre>
15+
1516
<pre class="link-defaults">
1617
spec:selectors-4; type:dfn; text:selector
18+
spec:html; type:dfn; text:states set
1719
</pre>
1820

1921
<h2 id="intro">
@@ -133,16 +135,24 @@ The local link pseudo-class '':local-link''</h3>
133135
<h2 id="custom-state">
134136
Exposing custom state: the '':state()'' pseudo-class</h2>
135137

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.
138142

139-
The grammar of the '':state()'' pseudo-class is:
143+
<!-- Using <<ident>>, rather than <<custom-ident>>,
144+
to avoid excluding the CSS-wide keywords. -->
140145

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.
142149

143150
The exact matching behavior of '':state()'' pseudo-class
144151
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.
146156

147157
<h2 id="combinators">
148158
Combinators</h2>

0 commit comments

Comments
 (0)