tor-browser

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

highlight-cascade-011.html (1420B)


      1 <!doctype html>
      2 <meta charset="utf-8">
      3 <title>CSS Pseudo-Elements Test: highlight cascade: inheritance of custom properties</title>
      4 <link rel="author" title="Stephen Chenney" href="mailto:schenney@chromium.org">
      5 <link rel="help" href="https://drafts.csswg.org/css-pseudo-4/#highlight-cascade">
      6 <link rel="help" href="https://github.com/w3c/csswg-drafts/issues/6641">
      7 <meta name="assert" content="This test verifies that custom properties used in highlight pseudos are taken from the highlight and originating element.">
      8 <script src="../support/selections.js"></script>
      9 <link rel="stylesheet" href="../support/highlights.css">
     10 <script src="/resources/testharness.js"></script>
     11 <script src="/resources/testharnessreport.js"></script>
     12 <style>
     13  :root::selection {
     14    --background-color: red;
     15  }
     16  div::selection {
     17    background-color: var(--background-color, green);
     18  }
     19 </style>
     20 <body>
     21  <div>Some text</div>
     22 </body>
     23 <script>
     24    selectNodeContents(document.querySelector("body"));
     25 
     26    const div_selection = getComputedStyle(document.querySelector("div"), "::selection");
     27    test(() => void assert_equals(div_selection.backgroundColor, "rgb(0, 128, 0)"),
     28        "div::selection does not inherit custom properties from the highlight parent");
     29    test(() => void assert_equals(div_selection.getPropertyValue("--background-color"), ""),
     30        "--background-color has no computed value on div::selection");
     31 </script>