tor-browser

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

invalidation-complex-selector-forward.html (1693B)


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