94fed8afa1
Tests are adapted from the official suite: http://www.w3.org/Style/CSS/Test/CSS3/Selectors/current/html/static/flat/ Test file format: Each test file is a HTML fragment with: <script> element with id="selectors": contains a JSON array of several selector definitions. Each selector definition has a selector string as input, a "match" array of the expected matched IDs. Some selectors must fail with a parse error, such selectors have an "error" key with the error location in the selector string. <div> element with id="testDOM": contains the DOM fragment which should be used to select the elements for each of the defined selectors.
31 lines
1.2 KiB
HTML
31 lines
1.2 KiB
HTML
<script type="application/json" id="selectors">
|
|
[{
|
|
"selector": "p:nth-last-of-type(3)",
|
|
"match": ["1"]
|
|
},
|
|
{
|
|
"selector": "dl > :nth-last-of-type(3n+1)",
|
|
"match": ["2", "3", "4", "5"]
|
|
}]
|
|
</script>
|
|
<div id="testDOM">
|
|
<p id="1" class="red">This paragraph should have green background</p>
|
|
<address>But this address is here only to fill space in the dom..</address>
|
|
<p>So does this paragraph !</p>
|
|
<p>And so does this one too.</p>
|
|
<dl>
|
|
<dt>First definition term</dt>
|
|
<dd>First definition</dd>
|
|
<dt>Second definition term</dt>
|
|
<dd>Second definition</dd>
|
|
<dt id="2" class="red">Third definition term that should have green background</dt>
|
|
<dd id="3" class="red">Third definition that should have green background</dd>
|
|
<dt>Fourth definition term</dt>
|
|
<dd>Fourth definition</dd>
|
|
<dt>Fifth definition term</dt>
|
|
<dd>Fifth definition</dd>
|
|
<dt id="4" class="red">Sixth definition term that should have green background</dt>
|
|
<dd id="5" class="red">Sixth definition that should have green background</dd>
|
|
</dl>
|
|
</div>
|