| <script src="../../resources/js-test-pre.js"></script> |
| :nth-last-child(even of target) { |
| background-color: rgb(1, 2, 3); |
| <div style="display:none" id="test-root"> |
| <target id="target"></target> |
| description('The selector :nth-last-child() should fail to match if the following sibling have not been parsed yet.'); |
| debug("Testing the state in the middle of HTML parsing.") |
| shouldBe('document.querySelectorAll(":nth-last-child(even of target)").length', '0'); |
| shouldBeEqualToString('getComputedStyle(document.getElementById("target")).backgroundColor', 'rgb(255, 255, 255)'); |
| debug("Testing the state after parsing the test sub-tree.") |
| shouldBe('document.querySelectorAll(":nth-last-child(n of target)").length', '2'); |
| shouldBe('document.querySelectorAll(":nth-last-child(even of target)").length', '1'); |
| shouldBeEqualToString('getComputedStyle(document.getElementById("target")).backgroundColor', 'rgb(1, 2, 3)'); |
| <script src="../../resources/js-test-post.js"></script> |