1--TEST-- 2CSS Selectors - Pseudo classes: nth-child of 3--EXTENSIONS-- 4dom 5--FILE-- 6<?php 7 8require __DIR__ . '/test_utils.inc'; 9 10$dom = DOM\XMLDocument::createFromString(<<<XML 11<container> 12 <h2 class="hi">1</h2> 13 <h2>2</h2> 14 <h2 class="hi">3</h2> 15 <h2 class="hi">4</h2> 16 <h2>5</h2> 17 <h2 class="hi">6</h2> 18</container> 19XML); 20 21test_helper($dom, 'h2:nth-child(even of .hi)'); 22test_helper($dom, 'h2.hi:nth-child(even)'); 23test_helper($dom, 'h2:nth-child(odd of .hi)'); 24test_helper($dom, 'h2.hi:nth-child(odd)'); 25 26test_helper($dom, 'h2:nth-last-child(even of .hi)'); 27test_helper($dom, 'h2.hi:nth-last-child(even)'); 28test_helper($dom, 'h2:nth-last-child(odd of .hi)'); 29test_helper($dom, 'h2.hi:nth-last-child(odd)'); 30 31?> 32--EXPECT-- 33--- Selector: h2:nth-child(even of .hi) --- 34<h2 class="hi">3</h2> 35<h2 class="hi">6</h2> 36--- Selector: h2.hi:nth-child(even) --- 37<h2 class="hi">4</h2> 38<h2 class="hi">6</h2> 39--- Selector: h2:nth-child(odd of .hi) --- 40<h2 class="hi">1</h2> 41<h2 class="hi">4</h2> 42--- Selector: h2.hi:nth-child(odd) --- 43<h2 class="hi">1</h2> 44<h2 class="hi">3</h2> 45--- Selector: h2:nth-last-child(even of .hi) --- 46<h2 class="hi">1</h2> 47<h2 class="hi">4</h2> 48--- Selector: h2.hi:nth-last-child(even) --- 49<h2 class="hi">1</h2> 50<h2 class="hi">3</h2> 51--- Selector: h2:nth-last-child(odd of .hi) --- 52<h2 class="hi">3</h2> 53<h2 class="hi">6</h2> 54--- Selector: h2.hi:nth-last-child(odd) --- 55<h2 class="hi">4</h2> 56<h2 class="hi">6</h2> 57