Skip to content

Commit 1a03027

Browse files
committed
[selectors] Rephrase :nth-child() definition to work better with the sel argument.
--HG-- extra : rebase_source : 71115b137d5a68999142ae0abda31a2160867b36
1 parent c769d1c commit 1a03027

2 files changed

Lines changed: 194 additions & 403 deletions

File tree

selectors/Overview.bs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -105,25 +105,25 @@ Selectors Overview</h2>
105105
<tr>
106106
<td><code>*</code>
107107
<td>any element
108-
<td><a href="#universal-selector">Universal selector</a>
108+
<td><a href="#the-universal-selector" section>Universal selector</a>
109109
<td>2
110110
<tr>
111111
<td><code>E</code>
112112
<td>an element of type E
113-
<td><a href="#type-selectors">Type (tag name) selector</a>
113+
<td><a href="#type-selectors" section>Type (tag name) selector</a>
114114
<td>1
115115
<tbody>
116116
<tr>
117117
<td><code>E:not(<var>s1</var>, <var>s2</var>)</code>
118118
<td>an E element that does not match either <a>compound selector</a> <var>s1</var>
119119
or <a>compound selector</a> <var>s2</var>
120-
<td><a href="#negation">Negation pseudo-class</a>
120+
<td><a href="#negation" section>Negation pseudo-class</a>
121121
<td>3/4
122122
<tr>
123123
<td><code>E:matches(<var>s1</var>, <var>s2</var>)</code>
124124
<td>an E element that matches <a>compound selector</a> <var>s1</var>
125125
and/or <a>compound selector</a> <var>s2</var>
126-
<td><a href="#matches">Matches-any pseudo-class</a>
126+
<td><a href="#matches" section>Matches-any pseudo-class</a>
127127
<td>4
128128
<tr>
129129
<td><code>E:has(<var>rs1</var>, <var>rs2</var>)</code>
@@ -2576,9 +2576,9 @@ Child-indexed Pseudo-classes</h3>
25762576
'':nth-child()'' pseudo-class</h4>
25772577

25782578
The <dfn id='nth-child-pseudo' title=":nth-child()">:nth-child(<var>An+B</var> [of <var>sel</var>]? )</dfn>
2579-
pseudo-class notation represents an element that has <var>An+B</var>-1 siblings
2580-
<em>before</em> it in the document tree
2581-
which match the <a>selector list</a> <var>sel</var>.
2579+
pseudo-class notation represents the <var>An+B</var>th element
2580+
which matches the <a>selector list</a> <var>sel</var>
2581+
among its siblings.
25822582

25832583
The CSS Syntax Module [[!CSS3SYN]] defines the <a href="http://dev.w3.org/csswg/css-syntax/#anb"><var>An+B</var> notation</a>.
25842584
If <var>sel</var> is omitted,
@@ -2604,14 +2604,14 @@ Child-indexed Pseudo-classes</h3>
26042604
For example, the following selector matches the first three “important” list items,
26052605
denoted by the ''.important'' class:
26062606

2607-
<pre>li:nth-child(-n+3 of .important)</pre>
2607+
<pre>:nth-child(-n+3 of li.important)</pre>
26082608

26092609
Note that this is different from moving the selector outside of the function, like:
26102610

26112611
<pre>li.important:nth-child(-n+3)</pre>
26122612

2613-
This selector instead just selects the first three list items
2614-
if they also have the ''.important'' class.
2613+
This selector instead just selects the first three children
2614+
if they also happen to be "important" list items.
26152615
</div>
26162616

26172617
<div class="example">

0 commit comments

Comments
 (0)