all-hosts.html (1515B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <title>CSS Shadow Parts - All Hosts</title> 5 <meta href="mailto:fergal@chromium.org" rel="author" title="Fergal Daly"> 6 <link href="http://www.google.com/" rel="author" title="Google"> 7 <link href="https://drafts.csswg.org/css-shadow-parts/" rel="help"> 8 <script src="/resources/testharness.js"></script> 9 <script src="/resources/testharnessreport.js"></script> 10 <script src="support/shadow-helper.js"></script> 11 </head> 12 <body> 13 <style>::part(partp) { color: green; }</style> 14 <script>installCustomElement("custom-element", "custom-element-template");</script> 15 <template id="custom-element-template"> 16 <style>span { color: red; }</style> 17 <span id="part" part="partp">This text</span> 18 </template> 19 The following text should be green: 20 <custom-element id="c-e-1"></custom-element> 21 The following text should be green: 22 <custom-element id="c-e-2"></custom-element> 23 <script> 24 "use strict"; 25 const colorGreen = "rgb(0, 128, 0)"; 26 test(function() { 27 const el = getElementByShadowIds(document, ["c-e-1", "part"]); 28 assert_equals(window.getComputedStyle(el).color, colorGreen); 29 }, "::part with host selector styles in first host"); 30 test(function() { 31 const el = getElementByShadowIds(document, ["c-e-2", "part"]); 32 assert_equals(window.getComputedStyle(el).color, colorGreen); 33 }, "::part with host selector styles in second host"); 34 </script> 35 </body> 36 </html>