Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(204)

Side by Side Diff: LayoutTests/fast/selectors/element-closest-scope.html

Issue 701723007: Adding Element.closest() API (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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.');
16
17 var theTarget = document.getElementById('theTarget');
18 var body = document.body;
19
20 shouldBe('theTarget.closest(":scope")', 'theTarget');
21 shouldBe('theTarget.closest(":not(:scope)")', 'body');
22
23 shouldBe('theTarget.closest("body :scope")', 'theTarget');
24 shouldBe('theTarget.closest("body > :scope")', 'theTarget');
25 shouldBeNull('theTarget.closest("body:scope")');
26
27 shouldBe('theTarget.closest("sibling + :scope")', 'theTarget');
28 shouldBe('theTarget.closest("sibling ~ :scope")', 'theTarget');
29
30 shouldBe('theTarget.closest("#theTarget:scope")', 'theTarget');
31 shouldBe('theTarget.closest(":scope#theTarget")', 'theTarget');
32
33 shouldBe('theTarget.closest("[webkit]:scope#theTarget")', 'theTarget');
34 shouldBeNull('theTarget.closest(":not([webkit=fast]):scope#theTarget")');
35
36 shouldBeNull('theTarget.closest(":scope target")');
37 shouldBeNull('theTarget.closest(":scope > target")');
38 shouldBeNull('theTarget.closest(":scope + target")');
39 shouldBeNull('theTarget.closest(":scope ~ target")');
40
41 shouldBeNull('theTarget.closest(":scope *")');
42 shouldBeNull('theTarget.closest(":scope > *")');
43 shouldBeNull('theTarget.closest(":scope + *")');
44 shouldBeNull('theTarget.closest(":scope ~ *")');
45 </script>
46 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698