tor-browser

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

active-selection-018.html (1656B)


      1 <!DOCTYPE html>
      2 
      3  <meta charset="UTF-8">
      4 
      5  <title>CSS Pseudo-Elements Test: active selection, color and background-color</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-selectors">
      9  <link rel="help" href="https://www.w3.org/TR/css-pseudo-4/#highlight-styling">
     10  <link rel="match" href="reference/active-selection-018-ref.html">
     11 
     12 
     13  <link rel="stylesheet" href="support/highlights.css">
     14  <style>
     15  div
     16    {
     17      color: green;
     18      font-size: 300%;
     19    }
     20 
     21  span
     22    {
     23      color: red;
     24    }
     25 
     26  div::selection
     27    {
     28      background-color: white;
     29    }
     30  /*
     31  This div::selection rule is necessary. Without it,
     32  "Selected Text" would be using the OS-default
     33  highlight colors for ::selection
     34  because neither color nor background-color would have
     35  been specified by the author.
     36  */
     37 
     38  span::selection
     39    {
     40      color: white;
     41    }
     42  </style>
     43 
     44  <script>
     45  function startTest()
     46  {
     47  var targetRange = document.createRange();
     48  /* We first create an empty range */
     49  targetRange.selectNodeContents(document.getElementById("parent"));
     50  /* Then we set the range boundaries to the children of div#parent */
     51  window.getSelection().addRange(targetRange);
     52  /* Finally, we now select such range of content */
     53  }
     54  </script>
     55 
     56  <body onload="startTest();">
     57 
     58  <p>Test passes if each glyph of "Selected Text" is green, if background color of each glyph of "Selected Text" is white and if there is <strong>no red</strong>.
     59 
     60  <div id="parent" class="highlight_reftest">Selected Text <span>FAIL</span></div>