31 lines
997 B
HTML
31 lines
997 B
HTML
<!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 with id filter works correctly.');
|
|
|
|
var scope = document.getElementById('scope');
|
|
shouldBe('scope.parentNode.querySelectorAll(":scope #scope a").item(0)', 'scope.firstChild');
|
|
shouldBe('scope.parentNode.querySelectorAll(":scope #scope a").length', '1');
|
|
shouldBe('scope.querySelectorAll(":scope #scope a").length', '0');
|
|
shouldBe('scope.parentNode.querySelectorAll(":scope #scope + li").length', '1');
|
|
shouldBe('scope.parentNode.querySelectorAll(":scope #scope + li").item(0)', 'scope.parentNode.children[1]');
|
|
shouldBe('document.querySelectorAll(":scope #scope a").item(0)', 'scope.firstChild');
|
|
|
|
</script>
|
|
<script src="../../resources/js-test-post.js"></script>
|
|
</html>
|