diff --git a/tests/css/parser/Makefile.am b/tests/css/parser/Makefile.am index b300d12c87..75ba54f238 100644 --- a/tests/css/parser/Makefile.am +++ b/tests/css/parser/Makefile.am @@ -297,6 +297,8 @@ EXTRA_DIST += \ linear-gradient.ref.css \ no-semicolon.css \ no-semicolon.ref.css \ + nth-child.css \ + nth-child.ref.css \ pseudo-classes-unknown.css \ pseudo-classes-unknown.errors \ pseudo-classes-unknown.ref.css \ diff --git a/tests/css/parser/nth-child.css b/tests/css/parser/nth-child.css new file mode 100644 index 0000000000..7860a3b3db --- /dev/null +++ b/tests/css/parser/nth-child.css @@ -0,0 +1,292 @@ +a:nth-last-child( odd ) { color: red } +a:nth-child(even ) { color: red } +b:nth-child( /**/n) { color: red } +c:nth-child(/**/ n + +0) { color: red } +d:nth-child( n + 1) { color: red } +e:nth-child( /**/n+ 2) { color: red } +f:nth-last-child( n+ 10) { color: red } +g:nth-child( + + +n) { color: red } +h:nth-child(/**/ n +- 0) { color: red } +i:nth-child( +/**/ n -1) { color: red } +j:nth-child(/**/ /**/n - 2) { color: red } +k:nth-last-child( n - +10) { color: red } +l:nth-last-child( /**/0) { color: red } +m:nth-child( + 0n) { color: red } +n:nth-last-child( /**/0/**/n ++ +0) { color: red } +o:nth-last-child( 0 n + 1) { color: red } +p:nth-last-child( 0n+/**/2) { color: red } +q:nth-last-child( + 0 n + 10) { color: red } +r:nth-child( 0 +n) { color: red } +s:nth-child( + 0 n -/**/0) { color: red } +t:nth-last-child( +0 +n +- 1) { color: red } +u:nth-last-child( 0 n -/**/2) { color: red } +v:nth-last-child( 0n -10) { color: red } +w:nth-last-child( 1) { color: red } +x:nth-child( +1n) { color: red } +y:nth-child(/**//**/1 n + +0) { color: red } +z:nth-child( +1 +n + +1) { color: red } +ab:nth-child( + 1 n +2) { color: red } +bb:nth-last-child( 1n + +10) { color: red } +cb:nth-last-child(1/**/n) { color: red } +db:nth-last-child( 1 n -0) { color: red } +eb:nth-child( 1 n- +1) { color: red } +fb:nth-child(/**/ +1 n- +2) { color: red } +gb:nth-child( 1n -10) { color: red } +hb:nth-last-child(/**/ 2) { color: red } +ib:nth-child( 2 n) { color: red } +jb:nth-last-child( 2 n + +0) { color: red } +kb:nth-child(/**/ 2n+ 1) { color: red } +lb:nth-child(/**//**/2/**/n ++ 2) { color: red } +mb:nth-last-child( +2 +n + +10) { color: red } +nb:nth-last-child( +2n) { color: red } +ob:nth-child( +2 n - 0) { color: red } +pb:nth-last-child( + 2n/**/-/**/1) { color: red } +qb:nth-child( /**/2 n - 2) { color: red } +rb:nth-last-child( + 2/**/n - 10) { color: red } +sb:nth-child( 10) { color: red } +tb:nth-last-child( + 10n) { color: red } +ub:nth-last-child( + 10/**/n/**/+ 0) { color: red } +vb:nth-child( 10 +n+/**/1) { color: red } +wb:nth-last-child( 10 n + +2) { color: red } +xb:nth-child( 10/**/n + 10) { color: red } +yb:nth-last-child( 10 +n) { color: red } +zb:nth-last-child( 10 n +-0) { color: red } +ac:nth-last-child(10n/**/- +1) { color: red } +bc:nth-child( 10 n +-/**/2) { color: red } +cc:nth-child( +/**/10 n +- 10) { color: red } +dc:nth-child( even ) { color: red } +ec:nth-last-child( ++ +/**/n) { color: red } +fc:nth-child( + n+ +0) { color: red } +gc:nth-child(/**/+ + +n + 1) { color: red } +hc:nth-last-child(/**/+ n +/**/2) { color: red } +ic:nth-last-child( + +n +10) { color: red } +jc:nth-last-child( + n) { color: red } +kc:nth-last-child( +/**/ n - 0) { color: red } +lc:nth-last-child( +n - 1) { color: red } +mc:nth-child( ++ n-2) { color: red } +nc:nth-last-child(+ n -10) { color: red } +oc:nth-child( ++ 0) { color: red } +pc:nth-child( +0 n) { color: red } +qc:nth-last-child( +/**/0/**/n ++ +0) { color: red } +rc:nth-last-child(/**/+ 0 n + 1) { color: red } +sc:nth-last-child( ++0 n/**/+2) { color: red } +tc:nth-child( + 0 +n+ 10) { color: red } +uc:nth-child( ++ 0 +n) { color: red } +vc:nth-last-child( ++ 0n +- +0) { color: red } +wc:nth-last-child(/**/+/**/0n - 1) { color: red } +xc:nth-child( + +0n - 2) { color: red } +yc:nth-last-child( ++ 0/**/n -/**/10) { color: red } +zc:nth-child(+ +1) { color: red } +ad:nth-child(/**/+ 1 +n) { color: red } +bd:nth-last-child(+/**/1 n + +0) { color: red } +cd:nth-child(/**/+/**/1 +n + +1) { color: red } +dd:nth-child(/**/+ +1 n +2) { color: red } +ed:nth-child( ++ 1n + +10) { color: red } +fd:nth-child( + 1 n) { color: red } +gd:nth-child( + 1 +n -0) { color: red } +hd:nth-child(+ 1n- 1) { color: red } +id:nth-child( + 1 n- 2) { color: red } +jd:nth-last-child( +/**/1n -/**/10) { color: red } +kd:nth-last-child( + 2) { color: red } +ld:nth-child(/**/+ 2n) { color: red } +md:nth-last-child( + 2 n/**/+/**/0) { color: red } +nd:nth-child(/**/+ 2 +n + 1) { color: red } +od:nth-child( + 2 n + +2) { color: red } +pd:nth-last-child( ++ 2/**/n +/**/10) { color: red } +qd:nth-last-child(+/**/2/**/n) { color: red } +rd:nth-child(+ 2 n/**/-0) { color: red } +sd:nth-child( + 2 +n - 1) { color: red } +td:nth-last-child( +2 +n +- 2) { color: red } +ud:nth-last-child( + 2 +n - 10) { color: red } +vd:nth-last-child(+ 10) { color: red } +wd:nth-child( +10n) { color: red } +xd:nth-last-child(/**/+ +10 +n + 0) { color: red } +yd:nth-last-child(/**/+ 10 n +/**/1) { color: red } +zd:nth-last-child( + 10 n+ 2) { color: red } +ae:nth-last-child( ++ 10 n +/**/10) { color: red } +be:nth-last-child( + 10/**/n) { color: red } +ce:nth-last-child( + 10/**/n- 0) { color: red } +de:nth-child(+10 n- +1) { color: red } +ee:nth-last-child( +/**/10 n/**/-2) { color: red } +fe:nth-last-child( + +10/**/n -10) { color: red } +ge:nth-last-child( +odd/**/) { color: red } +he:nth-last-child(/**/- n) { color: red } +ie:nth-last-child( +- +n + +0) { color: red } +je:nth-child(-/**/ n + 1) { color: red } +ke:nth-last-child(/**/- n +2) { color: red } +le:nth-last-child(/**/- n ++ 10) { color: red } +me:nth-last-child( +-/**/ n) { color: red } +ne:nth-child( +- n +- 0) { color: red } +oe:nth-last-child(- /**/n-1) { color: red } +pe:nth-child( - +n - 2) { color: red } +qe:nth-last-child(/**/-/**//**/n/**/- 10) { color: red } +re:nth-child( -/**/0) { color: red } +se:nth-last-child(/**/- +0 n) { color: red } +te:nth-child( +- 0 n+ +0) { color: red } +ue:nth-child( - +0/**/n+/**/1) { color: red } +ve:nth-last-child( +-/**/0 n ++ 2) { color: red } +we:nth-last-child( +-0 n/**/+ 10) { color: red } +xe:nth-last-child(- 0 +n) { color: red } +ye:nth-last-child( -0 n +- 0) { color: red } +ze:nth-last-child( - 0 n -/**/1) { color: red } +af:nth-last-child( -0/**/n - 2) { color: red } +bf:nth-child( - 0n +-10) { color: red } +cf:nth-child( - 1) { color: red } +df:nth-child( - 1 +n) { color: red } +ef:nth-last-child(/**/-1 n+ 0) { color: red } +ff:nth-child( +-/**/1 n/**/+ +1) { color: red } +gf:nth-last-child(- +1 n + 2) { color: red } +hf:nth-last-child( - +1 n ++ +10) { color: red } +if:nth-child( +- 1 n) { color: red } +jf:nth-last-child(- 1 n - 0) { color: red } +kf:nth-child(- 1 n - +1) { color: red } +lf:nth-child( - 1/**/n -/**/2) { color: red } +mf:nth-last-child( - +1/**/n -/**/10) { color: red } +nf:nth-last-child(/**/-/**/2) { color: red } +of:nth-child( - 2/**/n) { color: red } +pf:nth-child( +- 2 +n + 0) { color: red } +qf:nth-child( - 2 n +/**/1) { color: red } +rf:nth-child(/**/- 2 +n + +2) { color: red } +sf:nth-last-child( -/**/2/**/n ++ 10) { color: red } +tf:nth-child( -2 n) { color: red } +uf:nth-child(/**/- 2n - 0) { color: red } +vf:nth-last-child( -2 n-1) { color: red } +wf:nth-last-child(- 2/**/n - 2) { color: red } +xf:nth-child( -2 +n- +10) { color: red } +yf:nth-child( +-10) { color: red } +zf:nth-child( - 10/**/n) { color: red } +ag:nth-child( +- 10 n+ 0) { color: red } +bg:nth-last-child( +-/**/10n/**/+1) { color: red } +cg:nth-child( -/**/10 n +2) { color: red } +dg:nth-last-child(/**/- +10 n + 10) { color: red } +eg:nth-last-child(/**/- 10 n) { color: red } +fg:nth-last-child(- 10n - 0) { color: red } +gg:nth-last-child( -10n - 1) { color: red } +hg:nth-child(/**/- 10 n - 2) { color: red } +ig:nth-child(/**/- +10 n -10) { color: red } diff --git a/tests/css/parser/nth-child.ref.css b/tests/css/parser/nth-child.ref.css new file mode 100644 index 0000000000..a2c1378213 --- /dev/null +++ b/tests/css/parser/nth-child.ref.css @@ -0,0 +1,663 @@ +a:nth-last-child(odd) { + color: rgb(255,0,0); +} + +a:nth-child(even) { + color: rgb(255,0,0); +} + +b:nth-child(n) { + color: rgb(255,0,0); +} + +c:nth-child(n) { + color: rgb(255,0,0); +} + +d:nth-child(n+1) { + color: rgb(255,0,0); +} + +e:nth-child(n+2) { + color: rgb(255,0,0); +} + +f:nth-last-child(n+10) { + color: rgb(255,0,0); +} + +g:nth-child(n) { + color: rgb(255,0,0); +} + +h:nth-child(n) { + color: rgb(255,0,0); +} + +i:nth-child(n-1) { + color: rgb(255,0,0); +} + +j:nth-child(n-2) { + color: rgb(255,0,0); +} + +k:nth-last-child(n-10) { + color: rgb(255,0,0); +} + +l:nth-last-child(0) { + color: rgb(255,0,0); +} + +m:nth-child(0) { + color: rgb(255,0,0); +} + +n:nth-last-child(0) { + color: rgb(255,0,0); +} + +o:last-child { + color: rgb(255,0,0); +} + +p:nth-last-child(2) { + color: rgb(255,0,0); +} + +q:nth-last-child(10) { + color: rgb(255,0,0); +} + +r:nth-child(0) { + color: rgb(255,0,0); +} + +s:nth-child(0) { + color: rgb(255,0,0); +} + +t:nth-last-child(-1) { + color: rgb(255,0,0); +} + +u:nth-last-child(-2) { + color: rgb(255,0,0); +} + +v:nth-last-child(-10) { + color: rgb(255,0,0); +} + +w:last-child { + color: rgb(255,0,0); +} + +x:nth-child(n) { + color: rgb(255,0,0); +} + +y:nth-child(n) { + color: rgb(255,0,0); +} + +z:nth-child(n+1) { + color: rgb(255,0,0); +} + +ab:nth-child(n+2) { + color: rgb(255,0,0); +} + +bb:nth-last-child(n+10) { + color: rgb(255,0,0); +} + +cb:nth-last-child(n) { + color: rgb(255,0,0); +} + +db:nth-last-child(n) { + color: rgb(255,0,0); +} + +eb:nth-child(n-1) { + color: rgb(255,0,0); +} + +fb:nth-child(n-2) { + color: rgb(255,0,0); +} + +gb:nth-child(n-10) { + color: rgb(255,0,0); +} + +hb:nth-last-child(2) { + color: rgb(255,0,0); +} + +ib:nth-child(even) { + color: rgb(255,0,0); +} + +jb:nth-last-child(even) { + color: rgb(255,0,0); +} + +kb:nth-child(odd) { + color: rgb(255,0,0); +} + +lb:nth-child(2n+2) { + color: rgb(255,0,0); +} + +mb:nth-last-child(2n+10) { + color: rgb(255,0,0); +} + +nb:nth-last-child(even) { + color: rgb(255,0,0); +} + +ob:nth-child(even) { + color: rgb(255,0,0); +} + +pb:nth-last-child(2n-1) { + color: rgb(255,0,0); +} + +qb:nth-child(2n-2) { + color: rgb(255,0,0); +} + +rb:nth-last-child(2n-10) { + color: rgb(255,0,0); +} + +sb:nth-child(10) { + color: rgb(255,0,0); +} + +tb:nth-last-child(10n) { + color: rgb(255,0,0); +} + +ub:nth-last-child(10n) { + color: rgb(255,0,0); +} + +vb:nth-child(10n+1) { + color: rgb(255,0,0); +} + +wb:nth-last-child(10n+2) { + color: rgb(255,0,0); +} + +xb:nth-child(10n+10) { + color: rgb(255,0,0); +} + +yb:nth-last-child(10n) { + color: rgb(255,0,0); +} + +zb:nth-last-child(10n) { + color: rgb(255,0,0); +} + +ac:nth-last-child(10n-1) { + color: rgb(255,0,0); +} + +bc:nth-child(10n-2) { + color: rgb(255,0,0); +} + +cc:nth-child(10n-10) { + color: rgb(255,0,0); +} + +dc:nth-child(even) { + color: rgb(255,0,0); +} + +ec:nth-last-child(n) { + color: rgb(255,0,0); +} + +fc:nth-child(n) { + color: rgb(255,0,0); +} + +gc:nth-child(n+1) { + color: rgb(255,0,0); +} + +hc:nth-last-child(n+2) { + color: rgb(255,0,0); +} + +ic:nth-last-child(n+10) { + color: rgb(255,0,0); +} + +jc:nth-last-child(n) { + color: rgb(255,0,0); +} + +kc:nth-last-child(n) { + color: rgb(255,0,0); +} + +lc:nth-last-child(n-1) { + color: rgb(255,0,0); +} + +mc:nth-child(n-2) { + color: rgb(255,0,0); +} + +nc:nth-last-child(n-10) { + color: rgb(255,0,0); +} + +oc:nth-child(0) { + color: rgb(255,0,0); +} + +pc:nth-child(0) { + color: rgb(255,0,0); +} + +qc:nth-last-child(0) { + color: rgb(255,0,0); +} + +rc:last-child { + color: rgb(255,0,0); +} + +sc:nth-last-child(2) { + color: rgb(255,0,0); +} + +tc:nth-child(10) { + color: rgb(255,0,0); +} + +uc:nth-child(0) { + color: rgb(255,0,0); +} + +vc:nth-last-child(0) { + color: rgb(255,0,0); +} + +wc:nth-last-child(-1) { + color: rgb(255,0,0); +} + +xc:nth-child(-2) { + color: rgb(255,0,0); +} + +yc:nth-last-child(-10) { + color: rgb(255,0,0); +} + +zc:first-child { + color: rgb(255,0,0); +} + +ad:nth-child(n) { + color: rgb(255,0,0); +} + +bd:nth-last-child(n) { + color: rgb(255,0,0); +} + +cd:nth-child(n+1) { + color: rgb(255,0,0); +} + +dd:nth-child(n+2) { + color: rgb(255,0,0); +} + +ed:nth-child(n+10) { + color: rgb(255,0,0); +} + +fd:nth-child(n) { + color: rgb(255,0,0); +} + +gd:nth-child(n) { + color: rgb(255,0,0); +} + +hd:nth-child(n-1) { + color: rgb(255,0,0); +} + +id:nth-child(n-2) { + color: rgb(255,0,0); +} + +jd:nth-last-child(n-10) { + color: rgb(255,0,0); +} + +kd:nth-last-child(2) { + color: rgb(255,0,0); +} + +ld:nth-child(even) { + color: rgb(255,0,0); +} + +md:nth-last-child(even) { + color: rgb(255,0,0); +} + +nd:nth-child(odd) { + color: rgb(255,0,0); +} + +od:nth-child(2n+2) { + color: rgb(255,0,0); +} + +pd:nth-last-child(2n+10) { + color: rgb(255,0,0); +} + +qd:nth-last-child(even) { + color: rgb(255,0,0); +} + +rd:nth-child(even) { + color: rgb(255,0,0); +} + +sd:nth-child(2n-1) { + color: rgb(255,0,0); +} + +td:nth-last-child(2n-2) { + color: rgb(255,0,0); +} + +ud:nth-last-child(2n-10) { + color: rgb(255,0,0); +} + +vd:nth-last-child(10) { + color: rgb(255,0,0); +} + +wd:nth-child(10n) { + color: rgb(255,0,0); +} + +xd:nth-last-child(10n) { + color: rgb(255,0,0); +} + +yd:nth-last-child(10n+1) { + color: rgb(255,0,0); +} + +zd:nth-last-child(10n+2) { + color: rgb(255,0,0); +} + +ae:nth-last-child(10n+10) { + color: rgb(255,0,0); +} + +be:nth-last-child(10n) { + color: rgb(255,0,0); +} + +ce:nth-last-child(10n) { + color: rgb(255,0,0); +} + +de:nth-child(10n-1) { + color: rgb(255,0,0); +} + +ee:nth-last-child(10n-2) { + color: rgb(255,0,0); +} + +fe:nth-last-child(10n-10) { + color: rgb(255,0,0); +} + +ge:nth-last-child(odd) { + color: rgb(255,0,0); +} + +he:nth-last-child(-n) { + color: rgb(255,0,0); +} + +ie:nth-last-child(-n) { + color: rgb(255,0,0); +} + +je:nth-child(-n+1) { + color: rgb(255,0,0); +} + +ke:nth-last-child(-n+2) { + color: rgb(255,0,0); +} + +le:nth-last-child(-n+10) { + color: rgb(255,0,0); +} + +me:nth-last-child(-n) { + color: rgb(255,0,0); +} + +ne:nth-child(-n) { + color: rgb(255,0,0); +} + +oe:nth-last-child(-n-1) { + color: rgb(255,0,0); +} + +pe:nth-child(-n-2) { + color: rgb(255,0,0); +} + +qe:nth-last-child(-n-10) { + color: rgb(255,0,0); +} + +re:nth-child(0) { + color: rgb(255,0,0); +} + +se:nth-last-child(0) { + color: rgb(255,0,0); +} + +te:nth-child(0) { + color: rgb(255,0,0); +} + +ue:first-child { + color: rgb(255,0,0); +} + +ve:nth-last-child(2) { + color: rgb(255,0,0); +} + +we:nth-last-child(10) { + color: rgb(255,0,0); +} + +xe:nth-last-child(0) { + color: rgb(255,0,0); +} + +ye:nth-last-child(0) { + color: rgb(255,0,0); +} + +ze:nth-last-child(-1) { + color: rgb(255,0,0); +} + +af:nth-last-child(-2) { + color: rgb(255,0,0); +} + +bf:nth-child(-10) { + color: rgb(255,0,0); +} + +cf:nth-child(-1) { + color: rgb(255,0,0); +} + +df:nth-child(-n) { + color: rgb(255,0,0); +} + +ef:nth-last-child(-n) { + color: rgb(255,0,0); +} + +ff:nth-child(-n+1) { + color: rgb(255,0,0); +} + +gf:nth-last-child(-n+2) { + color: rgb(255,0,0); +} + +hf:nth-last-child(-n+10) { + color: rgb(255,0,0); +} + +if:nth-child(-n) { + color: rgb(255,0,0); +} + +jf:nth-last-child(-n) { + color: rgb(255,0,0); +} + +kf:nth-child(-n-1) { + color: rgb(255,0,0); +} + +lf:nth-child(-n-2) { + color: rgb(255,0,0); +} + +mf:nth-last-child(-n-10) { + color: rgb(255,0,0); +} + +nf:nth-last-child(-2) { + color: rgb(255,0,0); +} + +of:nth-child(-2n) { + color: rgb(255,0,0); +} + +pf:nth-child(-2n) { + color: rgb(255,0,0); +} + +qf:nth-child(-2n+1) { + color: rgb(255,0,0); +} + +rf:nth-child(-2n+2) { + color: rgb(255,0,0); +} + +sf:nth-last-child(-2n+10) { + color: rgb(255,0,0); +} + +tf:nth-child(-2n) { + color: rgb(255,0,0); +} + +uf:nth-child(-2n) { + color: rgb(255,0,0); +} + +vf:nth-last-child(-2n-1) { + color: rgb(255,0,0); +} + +wf:nth-last-child(-2n-2) { + color: rgb(255,0,0); +} + +xf:nth-child(-2n-10) { + color: rgb(255,0,0); +} + +yf:nth-child(-10) { + color: rgb(255,0,0); +} + +zf:nth-child(-10n) { + color: rgb(255,0,0); +} + +ag:nth-child(-10n) { + color: rgb(255,0,0); +} + +bg:nth-last-child(-10n+1) { + color: rgb(255,0,0); +} + +cg:nth-child(-10n+2) { + color: rgb(255,0,0); +} + +dg:nth-last-child(-10n+10) { + color: rgb(255,0,0); +} + +eg:nth-last-child(-10n) { + color: rgb(255,0,0); +} + +fg:nth-last-child(-10n) { + color: rgb(255,0,0); +} + +gg:nth-last-child(-10n-1) { + color: rgb(255,0,0); +} + +hg:nth-child(-10n-2) { + color: rgb(255,0,0); +} + +ig:nth-child(-10n-10) { + color: rgb(255,0,0); +}