tor-browser

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

custom-highlight-container-metrics-003.html (1317B)


      1 <!DOCTYPE html>
      2 <meta charset="UTF-8">
      3 <title>CSS Highlight API Test: Highlights using container sizes</title>
      4 <link rel="help" href="https://drafts.csswg.org/css-highlight-api-1/">
      5 <link rel="help" href="https://drafts.csswg.org/css-pseudo/#highlight-styling">
      6 <link rel="help" href="https://drafts.csswg.org/css-conditional-5/#container-lengths">
      7 <link rel="match" href="custom-highlight-container-metrics-003-ref.html">
      8 <meta name="assert" value="lengths depending on containers take the correct values and a highlight defined inside the container renders only within the container">
      9 <head>
     10  <style>
     11    .wrapper {
     12      container: wrapper / size;
     13      width: 200px;
     14      height: 100px;
     15    }
     16    @container (width > 100px) {
     17      ::highlight(highlight1) {
     18        text-underline-offset: 2cqw;
     19        text-decoration-line: underline;
     20        text-decoration-color: green;
     21        text-decoration-thickness: 4cqh;
     22      }
     23    }
     24  </style>
     25 </head>
     26 <body>
     27  <div class="wrapper">
     28    <div id="h1">With container size</div>
     29  </div>
     30  <div id="h2">Should be no highlight</div>
     31  <script>
     32    let r1 = new Range();
     33    r1.setStart(h1, 0);
     34    r1.setEnd(h1, 1);
     35    let r2 = new Range();
     36    r2.setStart(h2, 0);
     37    r2.setEnd(h2, 1);
     38    CSS.highlights.set("highlight1", new Highlight(r1, r2));
     39  </script>
     40 </body>