tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

multiple-parts.html (1917B)


      1 <!DOCTYPE html>
      2 <html>
      3  <head>
      4    <title>CSS Shadow Parts - Multiple parts</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>#c-e::part(partp1 partp2) { color: green; }</style>
     14    <script>installCustomElement("custom-element", "custom-element-template");</script>
     15    <template id="custom-element-template">
     16      <style>
     17        .red { color: red; }
     18        .blue { color: blue; }
     19      </style>
     20      <span id="greenpart" class="red" part="partp1 partp2">green</span>
     21      <span id="bluepart1" class="blue" part="partp1">blue</span>
     22      <span id="bluepart2" class="blue" part="partp2">blue</span>
     23    </template>
     24    The following text should match its stated colour:
     25    <custom-element id="c-e"></custom-element>
     26    <script>
     27      "use strict";
     28      const colorBlue = "rgb(0, 0, 255)";
     29      const colorGreen = "rgb(0, 128, 0)";
     30      test(function() {
     31        const el = getElementByShadowIds(document, ["c-e", "greenpart"]);
     32        assert_equals(window.getComputedStyle(el).color, colorGreen);
     33      }, "Double-part in selected host is styled");
     34      test(function() {
     35        const el = getElementByShadowIds(document, ["c-e", "bluepart1"]);
     36        assert_equals(window.getComputedStyle(el).color, colorBlue);
     37      }, "Single-part-1 in selected host is not styled");
     38      test(function() {
     39        const el = getElementByShadowIds(document, ["c-e", "bluepart2"]);
     40        assert_equals(window.getComputedStyle(el).color, colorBlue);
     41      }, "Single-part-2 in selected host is not styled");
     42    </script>
     43  </body>
     44 </html>