4 <script src=
"../../resources/js-test.js"></script>
7 testRunner
.dumpAsText();
12 <target id=
"theTarget" webkit=
"fast"></target>
15 description('This test makes sure that :scope works correctly with the closest() API.');
17 var theTarget
= document
.getElementById('theTarget');
18 var body
= document
.body
;
20 shouldBe('theTarget.closest(":scope")', 'theTarget');
21 shouldBe('theTarget.closest(":not(:scope)")', 'body');
23 shouldBe('theTarget.closest("body :scope")', 'theTarget');
24 shouldBe('theTarget.closest("body > :scope")', 'theTarget');
25 shouldBeNull('theTarget.closest("body:scope")');
27 shouldBe('theTarget.closest("sibling + :scope")', 'theTarget');
28 shouldBe('theTarget.closest("sibling ~ :scope")', 'theTarget');
30 shouldBe('theTarget.closest("#theTarget:scope")', 'theTarget');
31 shouldBe('theTarget.closest(":scope#theTarget")', 'theTarget');
33 shouldBe('theTarget.closest("[webkit]:scope#theTarget")', 'theTarget');
34 shouldBeNull('theTarget.closest(":not([webkit=fast]):scope#theTarget")');
36 shouldBeNull('theTarget.closest(":scope target")');
37 shouldBeNull('theTarget.closest(":scope > target")');
38 shouldBeNull('theTarget.closest(":scope + target")');
39 shouldBeNull('theTarget.closest(":scope ~ target")');
41 shouldBeNull('theTarget.closest(":scope *")');
42 shouldBeNull('theTarget.closest(":scope > *")');
43 shouldBeNull('theTarget.closest(":scope + *")');
44 shouldBeNull('theTarget.closest(":scope ~ *")');