blob: e6a1f862e8c9305e6f3416a333d42336fafb9023 [file] [log] [blame]
<!doctype html>
<html>
<head>
<script src="../../resources/js-test-pre.js"></script>
<script>
if (window.testRunner)
testRunner.dumpAsText();
</script>
</head>
<body>
<sibling></sibling>
<target id="theTarget" webkit="fast"></target>
</body>
<script>
description('This test makes sure that :scope works correctly with the matches() API.');
var theTarget = document.getElementById('theTarget');
shouldBeTrue('theTarget.matches(":scope")');
shouldBeFalse('theTarget.matches(":not(:scope)")');
shouldBeTrue('theTarget.matches("body :scope")');
shouldBeTrue('theTarget.matches("body>:scope")');
shouldBeTrue('theTarget.matches("sibling + :scope")');
shouldBeTrue('theTarget.matches("sibling ~ :scope")');
shouldBeTrue('theTarget.matches("#theTarget:scope")');
shouldBeTrue('theTarget.matches(":scope#theTarget")');
shouldBeTrue('theTarget.matches("[webkit]:scope#theTarget")');
shouldBeFalse('theTarget.matches(":not([webkit=fast]):scope#theTarget")');
shouldBeFalse('theTarget.matches(":scope target")');
shouldBeFalse('theTarget.matches(":scope > target")');
shouldBeFalse('theTarget.matches(":scope + target")');
shouldBeFalse('theTarget.matches(":scope ~ target")');
shouldBeFalse('theTarget.matches(":scope *")');
shouldBeFalse('theTarget.matches(":scope > *")');
shouldBeFalse('theTarget.matches(":scope + *")');
shouldBeFalse('theTarget.matches(":scope ~ *")');
</script>
<script src="../../resources/js-test-post.js"></script>
</html>