Skip to content

Commit

Permalink
Fix An+B explanation to be correct, and add a reminder note about the…
Browse files Browse the repository at this point in the history
… element list being 1-indexed. Also fix some Bikeshed warnings. Fixes #2321.
  • Loading branch information
tabatkins committed Feb 16, 2018
1 parent cc05885 commit 9380555
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions selectors-4/Overview.bs
Expand Up @@ -24,11 +24,16 @@ At Risk: the column combinator
At Risk: the '':drop()'' pseudo-class
At Risk: the '':read-write'' pseudo-class
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
Ignored Vars: identifier, extended filtering
Ignored Vars: identifier, extended filtering, i
</pre>
<pre class=link-defaults>
spec:css-syntax-3; type:dfn; text:identifier
spec:css-display-3; type:property; text:display
spec:css-pseudo-4; type:selector;
text: ::before
text: ::after
text: ::first-line
text: ::first-letter
</pre>

<style>
Expand Down Expand Up @@ -624,7 +629,7 @@ Structure and Terminology</h3>
if the type is important and unspecified,
it defaults to meaning a <a>list of complex selectors</a>.
(See [[#grouping]] for additional information on <a>selector lists</a>
and the various <<*-selector-list>> productions in the <a href="#grammar">grammar</a>
and the various &lt;*-selector-list> productions in the <a href="#grammar">grammar</a>
for their formal syntax.)
A given element is said to <a>match</a> a <a>selector list</a>
when it matches any (at least one) of the <a>selectors</a>
Expand Down Expand Up @@ -2742,7 +2747,11 @@ Child-indexed Pseudo-classes</h3>
The <var>An+B</var> notation and its interpretation
are defined in [[css-syntax-3#anb-microsyntax]];
it represents any index <var>i</var> = <var>A</var><var>n</var> + <var>B</var>
for any positive integer <var>n</var>.
for any integer <var>n</var> 0 or greater.

Note: For these purposes, the list of elements is <b>1-indexed</b>;
that is, the first child of an element has index 1, and will be matched by '':nth-child(2n+1)'',
because when <code>n=0</code> the expression evaluates to ''1''.

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

0 comments on commit 9380555

Please sign in to comment.