56 lines
1.4 KiB
HTML
56 lines
1.4 KiB
HTML
<!doctype html>
|
|
<html>
|
|
<head>
|
|
<title>Test for Bug 31267 - :nth-child(-2n) should match no element</title>
|
|
<style>
|
|
li {
|
|
color:green;
|
|
}
|
|
li:nth-child(-1n) {
|
|
color:red;
|
|
}
|
|
li:nth-child(-2n) {
|
|
color:red;
|
|
}
|
|
</style>
|
|
<script>
|
|
if (window.testRunner)
|
|
testRunner.dumpAsText();
|
|
|
|
function test()
|
|
{
|
|
var success = true;
|
|
for (var a_param = -1; a_param >= -2; a_param--) {
|
|
var nth_child = "li:nth-child(" + a_param + "n)";
|
|
var elements = document.querySelectorAll(nth_child);
|
|
if (elements.length != 0) {
|
|
success = false;
|
|
for (var i = 0; i < elements.length; i++)
|
|
elements[i].innerHTML = "FAIL: " + nth_child + " must not match any elements.";
|
|
}
|
|
}
|
|
|
|
var message = "FAIL";
|
|
var color = "red";
|
|
if (success) {
|
|
message = "PASS";
|
|
color = "green";
|
|
}
|
|
var result = document.getElementById("result");
|
|
result.innerHTML = message;
|
|
result.style.color = color;
|
|
}
|
|
</script>
|
|
<body onload="test()">
|
|
<ol>
|
|
<li>This must be green because li:nth-child(-an) must not match any elements.</li>
|
|
<li>This must be green because li:nth-child(-an) must not match any elements.</li>
|
|
<li>This must be green because li:nth-child(-an) must not match any elements.</li>
|
|
<li>This must be green because li:nth-child(-an) must not match any elements.</li>
|
|
</ol>
|
|
<div id="result">
|
|
Test didn't run
|
|
</div>
|
|
</body>
|
|
</html>
|