OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <script src="../../../resources/testharness.js"></script> | 2 <script src="../../../resources/testharness.js"></script> |
3 <script src="../../../resources/testharnessreport.js"></script> | 3 <script src="../../../resources/testharnessreport.js"></script> |
4 <style> | 4 <style> |
5 #container > div { | 5 #container > div { |
6 border: green solid thin; | 6 border: green solid thin; |
7 } | 7 } |
8 :lang(fr) { background:blue; color:white; } | 8 :lang(fr) { background:blue; color:white; } |
9 :lang(ja) { background:green; color:white; } | 9 :lang(ja) { background:green; color:white; } |
10 </style> | 10 </style> |
(...skipping 15 matching lines...) Expand all Loading... |
26 var style = "<style>:lang(fr) { background:blue; color:white; } :lang(ja) { back
ground:green; color:white; }</style>"; | 26 var style = "<style>:lang(fr) { background:blue; color:white; } :lang(ja) { back
ground:green; color:white; }</style>"; |
27 | 27 |
28 var host = document.getElementById("normal"); | 28 var host = document.getElementById("normal"); |
29 createShadowRootWithInnerHtml(host, style + "<div lang=fr>French</div><div>Inher
it Normally</div>"); | 29 createShadowRootWithInnerHtml(host, style + "<div lang=fr>French</div><div>Inher
it Normally</div>"); |
30 testLangInShadow("lang inherits into the shadow tree", | 30 testLangInShadow("lang inherits into the shadow tree", |
31 [[host.shadowRoot.querySelector("div"), fr], | 31 [[host.shadowRoot.querySelector("div"), fr], |
32 [host.shadowRoot.lastChild, ja]]); | 32 [host.shadowRoot.lastChild, ja]]); |
33 | 33 |
34 host = document.getElementById("distributed"); | 34 host = document.getElementById("distributed"); |
35 createShadowRootWithInnerHtml(host, style + "<div lang=fr><div>French</div><cont
ent></content></div>"); | 35 createShadowRootWithInnerHtml(host, style + "<div lang=fr><div>French</div><cont
ent></content></div>"); |
36 testLangInShadow("lang of the distributed content traverses the tree of trees", | 36 testLangInShadow("lang of the distributed content traverses the composed tree", |
37 [[host.shadowRoot.querySelector("div"), fr], | 37 [[host.shadowRoot.querySelector("div"), fr], |
38 [host.shadowRoot.host.firstChild, ja]]); | 38 [host.shadowRoot.host.firstChild, ja]]); |
39 | 39 |
40 host = document.getElementById("multiple"); | 40 host = document.getElementById("multiple"); |
41 createShadowRootWithInnerHtml(host, style + "<content></content>"); | 41 createShadowRootWithInnerHtml(host, style + "<content></content>"); |
42 createShadowRootWithInnerHtml(host, style + "<div lang=fr><div>French</div><cont
ent></content></div>"); | 42 createShadowRootWithInnerHtml(host, style + "<div lang=fr><div>French</div><cont
ent></content></div>"); |
43 testLangInShadow("lang of the distributed content traverses the tree of trees (m
ultiple shadow roots)", | 43 testLangInShadow("lang of the distributed content traverses the composed tree (m
ultiple shadow roots)", |
44 [[host.shadowRoot.querySelector("div"), fr], | 44 [[host.shadowRoot.querySelector("div"), fr], |
45 [host.shadowRoot.host.firstChild, ja]]); | 45 [host.shadowRoot.host.firstChild, ja]]); |
46 | 46 |
47 host = document.getElementById("multilevel"); | 47 host = document.getElementById("multilevel"); |
48 var host2ndLevel = createShadowRootWithInnerHtml(host, "<div><content></content>
</div>").firstChild; | 48 var host2ndLevel = createShadowRootWithInnerHtml(host, "<div><content></content>
</div>").firstChild; |
49 createShadowRootWithInnerHtml(host2ndLevel, style + "<div lang=fr><div>French</d
iv><content></content></div>"); | 49 createShadowRootWithInnerHtml(host2ndLevel, style + "<div lang=fr><div>French</d
iv><content></content></div>"); |
50 testLangInShadow("lang of the distributed content traverses the tree of trees (m
ultiple levels)", | 50 testLangInShadow("lang of the distributed content traverses the composed tree (m
ultiple levels)", |
51 [[host2ndLevel.shadowRoot.querySelector("div"), fr], | 51 [[host2ndLevel.shadowRoot.querySelector("div"), fr], |
52 [host.firstChild, ja]]); | 52 [host.firstChild, ja]]); |
53 | 53 |
54 host = document.getElementById("older"); | 54 host = document.getElementById("older"); |
55 createShadowRootWithInnerHtml(host, style + "<div>olderShadowRoot</div>"); | 55 createShadowRootWithInnerHtml(host, style + "<div>olderShadowRoot</div>"); |
56 createShadowRootWithInnerHtml(host, style + "<div lang=fr><div>French</div><shad
ow></shadow></div>"); | 56 createShadowRootWithInnerHtml(host, style + "<div lang=fr><div>French</div><shad
ow></shadow></div>"); |
57 testLangInShadow("lang of the older shadow root traverses the tree of trees", | 57 testLangInShadow("lang of the older shadow root traverses the composed tree", |
58 [[host.shadowRoot.querySelector("div"), fr], | 58 [[host.shadowRoot.querySelector("div"), fr], |
59 [host.shadowRoot.olderShadowRoot.querySelector("div"), ja]]); | 59 [host.shadowRoot.olderShadowRoot.querySelector("div"), ja]]); |
60 | 60 |
61 host = document.getElementById("redistributed"); | 61 host = document.getElementById("redistributed"); |
62 createShadowRootWithInnerHtml(host, style + "<div lang=fr><div>French</div><cont
ent></content></div>"); | 62 createShadowRootWithInnerHtml(host, style + "<div lang=fr><div>French</div><cont
ent></content></div>"); |
63 createShadowRootWithInnerHtml(host, style + "<shadow></shadow>"); | 63 createShadowRootWithInnerHtml(host, style + "<shadow></shadow>"); |
64 testLangInShadow("lang of the re-distributed content traverses the tree of trees
", | 64 testLangInShadow("lang of the re-distributed content traverses the composed tree
", |
65 [[host.shadowRoot.olderShadowRoot.querySelector("div"), fr], | 65 [[host.shadowRoot.olderShadowRoot.querySelector("div"), fr], |
66 [host.firstChild, ja]]); | 66 [host.firstChild, ja]]); |
67 | 67 |
68 function testLangInShadow(description, elementAndExpectedList) { | 68 function testLangInShadow(description, elementAndExpectedList) { |
69 test(function () { | 69 test(function () { |
70 elementAndExpectedList.forEach(function (elementAndExpected) { | 70 elementAndExpectedList.forEach(function (elementAndExpected) { |
71 var element = elementAndExpected[0]; | 71 var element = elementAndExpected[0]; |
72 var actual = getComputedStyle(element).backgroundColor; | 72 var actual = getComputedStyle(element).backgroundColor; |
73 assert_equals(actual, elementAndExpected[1]); | 73 assert_equals(actual, elementAndExpected[1]); |
74 }); | 74 }); |
75 }, description); | 75 }, description); |
76 } | 76 } |
77 | 77 |
78 function createShadowRootWithInnerHtml(host, shadowHtml) { | 78 function createShadowRootWithInnerHtml(host, shadowHtml) { |
79 var root = host.createShadowRoot(); | 79 var root = host.createShadowRoot(); |
80 root.innerHTML = shadowHtml; | 80 root.innerHTML = shadowHtml; |
81 return root; | 81 return root; |
82 } | 82 } |
83 | 83 |
84 if (window.testRunner) | 84 if (window.testRunner) |
85 container.style.display = "none"; | 85 container.style.display = "none"; |
86 done(); | 86 done(); |
87 </script> | 87 </script> |
OLD | NEW |