Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / selectors / element-closest-scope.html
blob68f9cb095d55b7620315429a440f94613d8b0f3f
1 <!doctype html>
2 <html>
3 <head>
4 <script src="../../resources/js-test.js"></script>
5 <script>
6 if (window.testRunner)
7 testRunner.dumpAsText();
8 </script>
9 </head>
10 <body>
11 <sibling></sibling>
12 <target id="theTarget" webkit="fast"></target>
13 </body>
14 <script>
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 ~ *")');
45 </script>
46 </html>