@@ -140,8 +140,9 @@ test('structural pseudo-classes', function (t) {
140
140
} ) ;
141
141
142
142
t . test ( ':nth-child' , function ( t ) {
143
+ // 6.6.5.2 explicitly states that matching element must have a parent.
143
144
t . deepEqual ( select ( ast , ':root:nth-child(0)' ) , [ ] ) ;
144
- t . deepEqual ( select ( ast , ':root:nth-child(n)' ) , [ ast ] ) ;
145
+ t . deepEqual ( select ( ast , ':root:nth-child(n)' ) , [ ] ) ;
145
146
t . deepEqual ( select ( ast , 'root > list:nth-child(2n+5)' ) ,
146
147
select ( ast , 'root > list' ) ) ;
147
148
t . deepEqual ( select ( ast , 'heading:nth-child(even)' ) , [
@@ -155,7 +156,7 @@ test('structural pseudo-classes', function (t) {
155
156
} ) ;
156
157
157
158
t . test ( ':first-child' , function ( t ) {
158
- t . deepEqual ( select ( ast , ':root:first-child' ) , [ ast ] ) ;
159
+ t . deepEqual ( select ( ast , ':root:first-child' ) , [ ] ) ;
159
160
t . deepEqual ( select ( ast , 'heading:first-child' ) , [ path ( ast , [ 0 ] ) ] ) ;
160
161
t . deepEqual ( select ( ast , 'list listItem:first-child [value]:first-child' ) , [
161
162
path ( ast , [ 4 , 0 , 0 , 0 ] ) ,
@@ -167,7 +168,7 @@ test('structural pseudo-classes', function (t) {
167
168
} ) ;
168
169
169
170
t . test ( ':last-child' , function ( t ) {
170
- t . deepEqual ( select ( ast , ':root:last-child' ) , [ ast ] ) ;
171
+ t . deepEqual ( select ( ast , ':root:last-child' ) , [ ] ) ;
171
172
t . deepEqual ( select ( ast , 'tableCell:last-child *' )
172
173
. map ( function ( node ) { return node . value } ) ,
173
174
[ 'mi' , 'dolor' , '15000' ] ) ;
0 commit comments