blob: 64575ea67079e514db272888cb8e33c4a24ec8b8 [file] [log] [blame]
<!doctype html>
<html>
<head>
<script src="../../resources/js-test-pre.js"></script>
<script>
if (window.testRunner)
testRunner.dumpAsText();
</script>
</head>
<body>
<ul>
<li id='scope'><a>abc</a></li>
<li>def</li>
<li><a>efg</a></li>
</ul>
</body>
<script>
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>
<script src="../../resources/js-test-post.js"></script>
</html>