tor-browser

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

highlight-z-index-001.html (1558B)


      1 <!DOCTYPE html>
      2 
      3  <meta charset="UTF-8">
      4 
      5  <title>CSS Pseudo-Elements Test: highlight pseudo-element drawn below positioned element</title>
      6 
      7  <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
      8  <link rel="help" href="https://www.w3.org/TR/css-pseudo-4/#highlight-painting">
      9  <link rel="match" href="highlight-z-index-001-ref.html">
     10 
     11  <meta name="assert" content="This test checks that the ::selection pseudo-element must be drawn below a relatively positioned element. In this test, such relatively positioned element is a preceding sibling element.">
     12 
     13  <style>
     14  div
     15    {
     16      font-size: 48px;
     17      line-height: 1.25; /* computes to 60px */
     18    }
     19 
     20  div#rel-positioned-sibling
     21    {
     22      background-color: yellow;
     23      color: green;
     24      display: inline-block;
     25      position: relative;
     26      top: 1.25em;
     27    }
     28 
     29  div#test::selection
     30    {
     31      background-color: red;
     32      color: yellow;
     33    }
     34  </style>
     35 
     36  <script>
     37  function startTest()
     38  {
     39  var targetRange = document.createRange();
     40  /* We first create an empty range */
     41  targetRange.selectNodeContents(document.getElementById("test"));
     42  /* Then we set the range boundaries to the children of div#test */
     43  window.getSelection().addRange(targetRange);
     44  /* Finally, we now select such range of content */
     45  }
     46  </script>
     47 
     48  <body onload="startTest();">
     49 
     50  <p>Test passes if "Text sample" is green and if its background color is yellow.
     51 
     52  <div id="rel-positioned-sibling">Test sample</div>
     53 
     54  <div id="test">Test sample</div>