tor-browser

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

selection-contenteditable-011.html (1320B)


      1 <!DOCTYPE html>
      2 
      3  <meta charset="UTF-8">
      4 
      5  <title>CSS Pseudo-Elements Test: active selection and contenteditable 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-selectors">
      9  <link rel="match" href="reference/selection-contenteditable-011-ref.html">
     10  <!-- Allow different antialiased pixels on the focus ring. -->
     11  <meta name="fuzzy" content="0-5;0-255">
     12 
     13  <style>
     14  div
     15    {
     16      background-color: red;
     17      color: yellow;
     18      display: inline;
     19      font-size: 300%;
     20    }
     21 
     22  div::selection
     23    {
     24      background-color: yellow;
     25      color: green;
     26    }
     27  </style>
     28 
     29  <script>
     30  function startTest()
     31  {
     32  var targetRange = document.createRange();
     33  /* We first create an empty range */
     34  targetRange.selectNodeContents(document.getElementById("test"));
     35  /* Then we set the range boundaries to the children of div#test */
     36  window.getSelection().addRange(targetRange);
     37  /* Finally, we now select such range of content */
     38  }
     39  </script>
     40 
     41  <body onload="startTest();">
     42 
     43  <p>Test passes if each glyph of "Selected Text" is green with a yellow background and if there is <strong>no red</strong>.
     44 
     45  <div contenteditable="true" id="test">Selected Text</div>