Skip to content

Commit 9380555

Browse files
committed
Fix An+B explanation to be correct, and add a reminder note about the element list being 1-indexed. Also fix some Bikeshed warnings. Fixes w3c#2321.
1 parent cc05885 commit 9380555

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

selectors-4/Overview.bs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,16 @@ At Risk: the column combinator
2424
At Risk: the '':drop()'' pseudo-class
2525
At Risk: the '':read-write'' pseudo-class
2626
Ignored Terms: function token, Document, DocumentFragment, math, h1, shadow tree, query(), quirks mode, button, a, span, object, p, div, q, area, link, label, input, html, em, li, ol, pre, CSS Value Definition Syntax
27-
Ignored Vars: identifier, extended filtering
27+
Ignored Vars: identifier, extended filtering, i
2828
</pre>
2929
<pre class=link-defaults>
3030
spec:css-syntax-3; type:dfn; text:identifier
3131
spec:css-display-3; type:property; text:display
32+
spec:css-pseudo-4; type:selector;
33+
text: ::before
34+
text: ::after
35+
text: ::first-line
36+
text: ::first-letter
3237
</pre>
3338

3439
<style>
@@ -624,7 +629,7 @@ Structure and Terminology</h3>
624629
if the type is important and unspecified,
625630
it defaults to meaning a <a>list of complex selectors</a>.
626631
(See [[#grouping]] for additional information on <a>selector lists</a>
627-
and the various <<*-selector-list>> productions in the <a href="#grammar">grammar</a>
632+
and the various &lt;*-selector-list> productions in the <a href="#grammar">grammar</a>
628633
for their formal syntax.)
629634
A given element is said to <a>match</a> a <a>selector list</a>
630635
when it matches any (at least one) of the <a>selectors</a>
@@ -2742,7 +2747,11 @@ Child-indexed Pseudo-classes</h3>
27422747
The <var>An+B</var> notation and its interpretation
27432748
are defined in [[css-syntax-3#anb-microsyntax]];
27442749
it represents any index <var>i</var> = <var>A</var><var>n</var> + <var>B</var>
2745-
for any positive integer <var>n</var>.
2750+
for any integer <var>n</var> 0 or greater.
2751+
2752+
Note: For these purposes, the list of elements is <b>1-indexed</b>;
2753+
that is, the first child of an element has index 1, and will be matched by '':nth-child(2n+1)'',
2754+
because when <code>n=0</code> the expression evaluates to ''1''.
27462755

27472756
For example, this selector could address every other row in a table,
27482757
and could be used to alternate the color of paragraph text in a cycle of four.

0 commit comments

Comments
 (0)