tor-browser

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

active-selection-057.html (2259B)


      1 <!DOCTYPE html>
      2 
      3  <meta charset="UTF-8">
      4 
      5  <title>CSS Pseudo-Elements Test: active selection and 3 empty elements</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/ref-nothing-below.xht">
     10 
     11  <meta name="assert" content="The &lt;div id=&quot;subtest1&quot;&gt; element and the &lt;hr&gt; element in this test are empty elements. Their background color can be painted but specifying their 'color' should generate no rendering effect of any kind. Since the 'background-color' has not been specified in the ::selection pseudo-element, then it defaults to 'transparent'. The &lt;div id=&quot;subtest3&quot;&gt; element is also an empty element since the 2 &amp;NewLine; character references are line break control characters. Their background color can not be painted. Therefore, in this test, nothing should be painted or viewable. The fact that lines break at preserved newline characters thanks to 'white-space: pre' does not change that.">
     12 
     13  <style>
     14  div#subtest1 , hr#subtest2
     15    {
     16      background-color: transparent; /* or initial or unset */
     17      height: 100px;
     18    }
     19 
     20  hr#subtest2
     21    {
     22      border: none 0px;
     23    }
     24 
     25  div#subtest1::selection , hr#subtest2::selection
     26    {
     27      color: red;
     28    }
     29 
     30  div#subtest3
     31    {
     32      background-color: transparent; /* or initial or unset */
     33      font-size: 100px;
     34      white-space: pre; /* or pre-line or pre-wrap or break-spaces */
     35    }
     36 
     37  div#subtest3::selection
     38    {
     39      background-color: red;
     40    }
     41  </style>
     42 
     43  <script>
     44  function startTest()
     45  {
     46  var targetRange = document.createRange();
     47  /* We first create an empty range */
     48  targetRange.selectNodeContents(document.getElementById("test"));
     49  /* Then we set the range boundaries to the children of div#test */
     50  window.getSelection().addRange(targetRange);
     51  /* Finally, we now select such range of content */
     52  }
     53  </script>
     54 
     55  <body onload="startTest();">
     56 
     57  <p>Test passes if there is nothing below.</p>
     58 
     59  <div id="test">
     60 
     61    <div id="subtest1">&nbsp;</div>
     62 
     63    <hr id="subtest2">
     64 
     65    <div id="subtest3">&NewLine;&NewLine;</div>
     66 
     67  </div>