tor-browser

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

invalidation-change-part-name-idl-setter.html (1350B)


      1 <!DOCTYPE html>
      2 <html>
      3  <head>
      4    <title>CSS Shadow Parts - Invalidation Change Part Name IDL Setter</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(partp) { color: red; }</style>
     14    <style>#c-e::part(new-partp) { color: green; }</style>
     15    <script>installCustomElement("custom-element", "custom-element-template");</script>
     16    <template id="custom-element-template">
     17      <style>span { color: blue; }</style>
     18      <span id="part" part="partp">This text</span>
     19    </template>
     20    The following text should be green:
     21    <div><custom-element id="c-e"></custom-element></div>
     22    <script>
     23      "use strict";
     24      const colorGreen = "rgb(0, 128, 0)";
     25      test(function() {
     26        const el = getElementByShadowIds(document, ["c-e", "part"]);
     27        el.part = "new-partp"
     28        assert_equals(window.getComputedStyle(el).color, colorGreen);
     29      }, "Part in selected host changed color via part IDL attribute setter.");
     30    </script>
     31  </body>
     32 </html>