tor-browser

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

custom-highlight-painting-staticrange-001.html (1317B)


      1 <!DOCTYPE html>
      2 <meta charset="UTF-8">
      3 <title>CSS Highlight API Test: Invalid StaticRanges are not painted</title>
      4 <link rel="help" href="https://drafts.csswg.org/css-highlight-api-1/">
      5 <link rel="match" href="custom-highlight-painting-staticrange-001-ref.html">
      6 <meta name="assert" value="StaticRanges that are invalid or collapsed should not be painted when they're in a Highlight">
      7 <style>
      8  ::highlight(example-highlight) {
      9    background-color: yellow;
     10    color: blue;
     11  }
     12 </style>
     13 <body><span id="first">One </span><span id="second">two </span><span id="third">three…</span>
     14 <script>
     15  let h = new Highlight();
     16  h.add(new StaticRange({startContainer: document.body, startOffset: 0, endContainer: document.body, endOffset: 0}));
     17  h.add(new StaticRange({startContainer: document.body, startOffset: 1, endContainer: document.body, endOffset: 0}));
     18  h.add(new StaticRange({startContainer: document.body, startOffset: 1, endContainer: document.body, endOffset: 100}));
     19  h.add(new StaticRange({startContainer: document, startOffset: 0, endContainer: document, endOffset: 1}));
     20  h.add(new StaticRange({startContainer: document.querySelector("#third").firstChild, startOffset: 1, endContainer: document.querySelector("#first").firstChild, endOffset: 2}));
     21  CSS.highlights.set("example-highlight", h);
     22 </script>