Skip to content

Commit 9a01521

Browse files
committed
[selectors-4] Make it clear that the name of the zero-specificity :matches() pseudo is not decided. #1170
1 parent 9d2be85 commit 9a01521

File tree

1 file changed

+44
-38
lines changed

1 file changed

+44
-38
lines changed

selectors-4/Overview.bs

+44-38
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,10 @@ Selectors Overview</h2>
132132
<td>[[#matches]]
133133
<td>4
134134
<tr>
135-
<td><code>E:is(<var>s1</var>, <var>s2</var>)</code>
135+
<td><code>E:something(<var>s1</var>, <var>s2</var>)</code>
136136
<td>an E element that matches <a>compound selector</a> <var>s1</var>
137137
and/or <a>compound selector</a> <var>s2</var> but contributes no specificity.
138-
<td>[[#is]]
138+
<td>[[#zero-matches]]
139139
<td>4
140140
<tr>
141141
<td><code>E:has(<var>rs1</var>, <var>rs2</var>)</code>
@@ -1091,47 +1091,53 @@ The Matches-any Pseudo-class: '':matches()''</h3>
10911091
<pre>*|*:matches(*:hover, *:focus) </pre>
10921092
</div>
10931093

1094-
<h3 id="is">
1095-
The Specificity-adjustment Pseudo-class: '':is()''</h3>
1094+
<h3 id="zero-matches">
1095+
The Specificity-adjustment Pseudo-class: '':something()''</h3>
10961096

1097-
The Specificity-adjustment pseudo-class '':is()'', is a functional pseudo-class
1098-
with the same syntax and functionality as '':matches()''.
1099-
Unlike '':matches()'', neither the pseudo-class, nor any of its arguments
1100-
contribute to the specificity of the selector.
1097+
The Specificity-adjustment pseudo-class, <dfn id="something-pseudo">'':something()''</dfn>,
1098+
is a functional pseudo-class
1099+
with the same syntax and functionality as '':matches()''.
1100+
Unlike '':matches()'', neither the pseudo-class, nor any of its arguments
1101+
contribute to the specificity of the selector--
1102+
its specificity is always zero.
11011103

1102-
This is useful for introducing filters in a selector while keeping it easy to override.
1104+
This is useful for introducing filters in a selector
1105+
while keeping the associated style declarations easy to override.
11031106

1104-
<div class="example">
1105-
Below is a common example where the specificity heuristic fails
1106-
to match author expectations:
1107+
ISSUE: This pseudo-class needs a name. See <a href="https://github.com/w3c/csswg-drafts/issues/1170">discussion</a>.
11071108

1108-
<pre>
1109-
a:not(:hover) {
1110-
text-decoration: none;
1111-
}
1109+
<div class="example">
1110+
Below is a common example where the specificity heuristic fails
1111+
to match author expectations:
11121112

1113-
nav a {
1114-
/* Has no effect */
1115-
text-decoration: underline;
1116-
}
1117-
</pre>
1113+
<pre>
1114+
a:not(:hover) {
1115+
text-decoration: none;
1116+
}
1117+
1118+
nav a {
1119+
/* Has no effect */
1120+
text-decoration: underline;
1121+
}
1122+
</pre>
11181123

1119-
However, by using '':is()'' the author can explicitly declare their intent:
1124+
However, by using '':something()'' the author can explicitly declare their intent:
11201125

1121-
<pre>
1122-
a:is(:not(:hover)) {
1123-
text-decoration: none;
1124-
}
1125-
1126-
nav a {
1127-
/* Works now! */
1128-
text-decoration: underline;
1129-
}
1130-
</pre>
1131-
</div>
1126+
<pre>
1127+
a:something(:not(:hover)) {
1128+
text-decoration: none;
1129+
}
1130+
1131+
nav a {
1132+
/* Works now! */
1133+
text-decoration: underline;
1134+
}
1135+
</pre>
1136+
</div>
11321137

1133-
Note: Future versions of this specification may introduce a second argument to explicitly set
1134-
the specificity of each instance of this pseudo-class, which will default to zero.
1138+
Note: Future versions of this specification may introduce a second argument
1139+
to explicitly set the specificity of each instance of this pseudo-class,
1140+
which will default to zero.
11351141

11361142
<h3 id="negation">
11371143
The Negation Pseudo-class: '':not()''</h3>
@@ -3135,7 +3141,7 @@ Calculating a selector's specificity</h2>
31353141
the specificity of its selector list argument.
31363142
(The full selector's specificity is equivalent to expanding out all the combinations in full, without '':matches()''.)
31373143
<li>
3138-
The specificity of an '':is()'' pseudo-class is replaced by 0.
3144+
The specificity of an '':something()'' pseudo-class is replaced by 0.
31393145
<li>
31403146
Similarly, the specificity of an '':nth-child()'', '':nth-last-child()'', '':nth-of-type()'', or '':nth-last-of-type()'' selector
31413147
is the specificity of the pseudo class itself (counting as one pseudo-class selector)
@@ -3153,7 +3159,7 @@ Calculating a selector's specificity</h2>
31533159
a specificity of (0,0,1)--like a tag selector--when matched against <code>&lt;em></code>,
31543160
and a specificity of (1,0,0)--like an ID selector--when matched against <code>&lt;em id=foo></code>.
31553161
<li>
3156-
''div:is(em, #foo#bar#baz)'' has
3162+
''div:something(em, #foo#bar#baz)'' has
31573163
a specificity of (0,0,1): only the ''div'' contributes to selector specificity.
31583164
<li>
31593165
'':nth-child(even of li, .item)'' has
@@ -3644,7 +3650,7 @@ Changes</h2>
36443650

36453651
<ul>
36463652
<li>Added '':target-within''</li>
3647-
<li>Added '':is()'' pseudo-class.</li>
3653+
<li>Added a zero-specificity '':matches()''-type pseudo-class, with name TBD.</li>
36483654
<li>Split out <a>relative selectors</a> from <a>scoped selectors</a>,
36493655
as these are different concepts that can be independently invoked.
36503656
<li>Changed rules for absolutizing a relative selector.

0 commit comments

Comments
 (0)