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

Unified Diff: third_party/WebKit/LayoutTests/shadow-dom/shadow-piercing-descendant-combinator.html

Issue 2532813002: Matching part for >>> (shadow-piercing descendant combinator). (Closed)
Patch Set: Created 4 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/shadow-dom/shadow-piercing-descendant-combinator.html
diff --git a/third_party/WebKit/LayoutTests/shadow-dom/shadow-piercing-descendant-combinator.html b/third_party/WebKit/LayoutTests/shadow-dom/shadow-piercing-descendant-combinator.html
new file mode 100644
index 0000000000000000000000000000000000000000..8c75fafb7ef6120f3ee8c8843d480d8eba116521
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/shadow-dom/shadow-piercing-descendant-combinator.html
@@ -0,0 +1,72 @@
+<!DOCTYPE html>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<script src="resources/shadow-dom.js"></script>
+<body>
+ <div id="testroot">
+ <div id="openhost">
+ <template data-mode="open">
+ <div id="inner-open"></div>
+ </template>
+ </div>
+ <div id="closedhost">
+ <template data-mode="closed">
+ <div id="inner-closed"></div>
+ </template>
+ </div>
+ <div id="v0host">
+ <template data-mode="v0">
+ <div id="inner-v0"></div>
+ </template>
+ </div>
+ <div id="nestedhost">
+ <template data-mode="open" data-expose-as="nestedRoot">
+ <div id="inner-div">
+ <div>
+ <template data-mode="open">
+ <div id="inner-nested-open"></div>
+ </template>
+ </div>
+ <div>
+ <template data-mode="closed">
+ <div id="inner-nested-closed"></div>
+ </template>
+ </div>
+ <div>
+ <template data-mode="v0">
+ <div id="inner-nested-v0"></div>
+ </template>
+ </div>
+ </div>
+ </template>
+ </div>
+ </div>
+</body>
+<script>
+convertTemplatesToShadowRootsWithin(testroot);
+test(() => {
+ assert_equals(document.querySelectorAll('body >>> #inner-open').length, 1);
+ assert_equals(document.querySelectorAll('body >>> #inner-closed').length, 0);
+ assert_equals(document.querySelectorAll('body >>> #inner-v0').length, 0);
+ assert_equals(document.querySelectorAll('body >>> #inner-nested-open').length, 1);
+ assert_equals(document.querySelectorAll('body >>> #inner-nested-closed').length, 0);
+ assert_equals(document.querySelectorAll('body >>> #inner-nested-v0').length, 0);
+}, '>>> should match only through open shadow roots.');
+
+test(() => {
+ let innerDiv = nestedRoot.querySelector('#inner-div');
+ assert_equals(innerDiv.querySelectorAll('body >>> #inner-nested-open').length, 0);
+ assert_equals(innerDiv.querySelectorAll('body >>> #inner-nested-closed').length, 0);
+ assert_equals(innerDiv.querySelectorAll('body >>> #inner-nested-v0').length, 0);
+ assert_equals(innerDiv.querySelectorAll('#inner-div >>> #inner-nested-open').length, 1);
+ assert_equals(innerDiv.querySelectorAll('#inner-div >>> #inner-nested-closed').length, 0);
+ assert_equals(innerDiv.querySelectorAll('#inner-div >>> #inner-nested-v0').length, 0);
+}, 'leftmost compound should match an element in the same node tree as context object.');
+
+test(() => {
+ assert_equals(document.querySelector('#testroot >>> #openhost').id, 'openhost');
+ assert_equals(document.querySelector('#testroot >>> #closedhost').id, 'closedhost');
+ assert_equals(document.querySelector('#testroot >>> #v0host').id, 'v0host');
+}, '>>> should match without piercing through shadow roots.');
+
+</script>

Powered by Google App Engine
This is Rietveld 408576698