| <script src="../../resources/js-test-pre.js"></script> |
| <li id='scope'><a>abc</a></li> |
| description('This test makes sure that :scope works correctly.'); |
| var scope = document.getElementById('scope'); |
| shouldBe('scope.querySelectorAll("ul a").length', '1'); |
| shouldBe('scope.querySelector("ul a")', 'scope.firstChild'); |
| shouldBe('scope.querySelectorAll(":scope ul a").length', '0'); |
| shouldBeNull('scope.querySelector(":scope ul a")'); |
| shouldBe('document.querySelectorAll(":scope ul a").length', '2'); |
| shouldBe('document.querySelectorAll(":root ul a").length', '2'); |
| shouldBe('document.querySelectorAll(":scope a").length', '2'); |
| shouldBe('scope.querySelectorAll(":scope a").length', '1'); |
| shouldBe('scope.querySelectorAll(":scope a").item(0)', 'scope.firstChild'); |
| shouldBe('scope.querySelector(":scope a")', 'scope.querySelectorAll(":scope a").item(0)'); |
| <script src="../../resources/js-test-post.js"></script> |