@@ -140,8 +140,9 @@ test('structural pseudo-classes', function (t) {
140140 } ) ;
141141
142142 t . test ( ':nth-child' , function ( t ) {
143+ // 6.6.5.2 explicitly states that matching element must have a parent.
143144 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)' ) , [ ] ) ;
145146 t . deepEqual ( select ( ast , 'root > list:nth-child(2n+5)' ) ,
146147 select ( ast , 'root > list' ) ) ;
147148 t . deepEqual ( select ( ast , 'heading:nth-child(even)' ) , [
@@ -155,7 +156,7 @@ test('structural pseudo-classes', function (t) {
155156 } ) ;
156157
157158 t . test ( ':first-child' , function ( t ) {
158- t . deepEqual ( select ( ast , ':root:first-child' ) , [ ast ] ) ;
159+ t . deepEqual ( select ( ast , ':root:first-child' ) , [ ] ) ;
159160 t . deepEqual ( select ( ast , 'heading:first-child' ) , [ path ( ast , [ 0 ] ) ] ) ;
160161 t . deepEqual ( select ( ast , 'list listItem:first-child [value]:first-child' ) , [
161162 path ( ast , [ 4 , 0 , 0 , 0 ] ) ,
@@ -167,7 +168,7 @@ test('structural pseudo-classes', function (t) {
167168 } ) ;
168169
169170 t . test ( ':last-child' , function ( t ) {
170- t . deepEqual ( select ( ast , ':root:last-child' ) , [ ast ] ) ;
171+ t . deepEqual ( select ( ast , ':root:last-child' ) , [ ] ) ;
171172 t . deepEqual ( select ( ast , 'tableCell:last-child *' )
172173 . map ( function ( node ) { return node . value } ) ,
173174 [ 'mi' , 'dolor' , '15000' ] ) ;
0 commit comments