tor-browser

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

invalidation-complex-selector.html (1358B)


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