<?xml-stylesheet href="../../../style/xhtml-full.css" type="text/css"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
 <head>
  <title>Contextual ::selection</title>
  <meta name="author" content="Ian Hickson"/>
  <link rel="stylesheet" type="text/css" href="../../../style/xhtml-full.css"/> <!-- yes this means compliant UAs get to import this twice -->
  <style type="text/css"><![CDATA[



  td > div { border: solid thick black; padding: 1em; line-height: 2; }
  td > div > span { padding: 0.25em; }

  /* test version */
  .test > *|* { background: aqua; }
  .test > div > ::selection { outline: solid thick green; }
  .test > div > :nth-child(even)::selection { outline: solid thick yellow; }
  .test > div > :empty::selection { outline: solid thick blue; background: red; }
  .test > div *|*::selection { background: transparent; } /* applies to spans 4 to 6 and the strong */
  .test span:first-child::selection { background: white; } /* selects "Cascadable" */
  .test span[id=b]::selection { background: silver; } /* selects "Advanced" */
  .test #b + * + * { background: green; color: white; } /* affects "Tree"'s span, whose selection inherits the background-color */
  .test span[id=b] ~ ::selection { background: inherit; color: inherit; } /* selects "Tree", "Selectors" and "for CSS" but is overriden for "Tree" and "for CSS" */
  .test span[id=b] + ::selection { background: yellow; cursor: crosshair; } /* selects "Tree" */
  .test :not(#b):last-child::selection { background: transparent; } /* selects "for CSS" and "CSS" */
  .test ::selection { color: black; } /* applies to all spans and the strong */
  .test::selection { background: red ! important; } /* applies to the text in the cell and the div... so nothing. */
  .test::selection { color: red ! important; background: aqua; } /* should end up doing nothing - no text at that level and background is aqua is already the background */
  .test strong { color: red ! important; } /* should also end up doing nothing */

  /* control version */
  .control::selection { background: transparent; color: inherit; cursor: inherit; outline: none; }
  .control > div { background: aqua; color: black; }
  .control > div > span { padding: 0; margin: 0.25em; }
  .control > div > span.a { background: white; }
  .control > div > span.b { background: silver; }
  .control > div > span.c { background: yellow; cursor: crosshair; }
  .control > div > span.d { background: green; color: white; padding: 0.25em; margin: 0; }
  .control > div > span.green { outline: solid thick green; }
  .control > div > span.yellow { outline: solid thick yellow; }
  .control > div > span.blue { outline: solid thick blue; background: red; }

]]></style>
  <link rel="first" href="css3-modsel-18.xml" title=":hover pseudo-class"/>
  <link rel="prev" href="css3-modsel-159.xml" title="Syntax and parsing of new pseudo-elements"/>
  <link rel="next" href="css3-modsel-163.xml" title="Contextual :contains"/>
  <link rel="last" href="css3-modsel-165.xml" title=":hover with ::selection"/>
  <link rel="up" href="./index.html"/>
  <link rel="top" href="../../../index.html"/>
 </head>
 <body>
  <table class="testDescription">
   <tr>
    <th class="b">CSS 3 Module</th> <!-- XXX hard coded to say CSS 3 -->
    <th class="c" colspan="2">
     <a href="css3-modsel-159.xml" title="Syntax and parsing of new pseudo-elements">&lt;==</a>
     Test #
     <a href="css3-modsel-163.xml" title="Contextual :contains">==&gt;</a>
    </th>
   </tr>
   <tr>
    <td class="b">W3C Selectors</td>
    <td class="c" colspan="2">12 of 15 of the interactive tests category</td>
   </tr>
   <tr>
    <th class="b">Testing</th>
    <th class="a">Date</th>
    <th class="a">Revision</th>
   </tr>
   <tr>
    <td class="b">Contextual ::selection (ID #162)</td>
    <td class="a">20-november-2001</td>
    <td class="a">1.0</td>
   </tr>
  </table>
  <p class="WARNING">NOTE: User interaction is required for this test.</p>
  <div class="testSource">
   <div class="testText">
  <div>

   <p>Select everything in this document. The following two constructs
   (in the thick black borders) should end up looking identical. You
   should also check that the cursor is the same on equivalent parts
   (in particular the cursor should be a crosshair over &quot;Tree&quot; and the
   default everywhere else.)</p>

   <table>
    <tr>
     <td class="test">

      <div>
       <span>Cascadable</span>
       <span id="b">Advanced</span>
       <span>Tree</span>
       <span>Selectors</span>
       <span><!-- empty --></span>
       <span>for <strong>CSS</strong></span>
      </div>

     </td>
     <td class="control">

      <div>
       <span class="a green">Cascadable</span>
       <span class="b yellow">Advanced</span>
       <span class="c green">Tree</span>
       <span class="d yellow">Selectors</span>
       <span class="e blue"></span>
       <span class="f yellow">for <strong>CSS</strong></span>
      </div>

     </td>
    </tr>
   </table>
  </div>
</div>
   <pre class="rules">



  td &gt; div { border: solid thick black; padding: 1em; line-height: 2; }
  td &gt; div &gt; span { padding: 0.25em; }

  /* test version */
  .test &gt; *|* { background: aqua; }
  .test &gt; div &gt; ::selection { outline: solid thick green; }
  .test &gt; div &gt; :nth-child(even)::selection { outline: solid thick yellow; }
  .test &gt; div &gt; :empty::selection { outline: solid thick blue; background: red; }
  .test &gt; div *|*::selection { background: transparent; } /* applies to spans 4 to 6 and the strong */
  .test span:first-child::selection { background: white; } /* selects &quot;Cascadable&quot; */
  .test span[id=b]::selection { background: silver; } /* selects &quot;Advanced&quot; */
  .test #b + * + * { background: green; color: white; } /* affects &quot;Tree&quot;&#39;s span, whose selection inherits the background-color */
  .test span[id=b] ~ ::selection { background: inherit; color: inherit; } /* selects &quot;Tree&quot;, &quot;Selectors&quot; and &quot;for CSS&quot; but is overriden for &quot;Tree&quot; and &quot;for CSS&quot; */
  .test span[id=b] + ::selection { background: yellow; cursor: crosshair; } /* selects &quot;Tree&quot; */
  .test :not(#b):last-child::selection { background: transparent; } /* selects &quot;for CSS&quot; and &quot;CSS&quot; */
  .test ::selection { color: black; } /* applies to all spans and the strong */
  .test::selection { background: red ! important; } /* applies to the text in the cell and the div... so nothing. */
  .test::selection { color: red ! important; background: aqua; } /* should end up doing nothing - no text at that level and background is aqua is already the background */
  .test strong { color: red ! important; } /* should also end up doing nothing */

  /* control version */
  .control::selection { background: transparent; color: inherit; cursor: inherit; outline: none; }
  .control &gt; div { background: aqua; color: black; }
  .control &gt; div &gt; span { padding: 0; margin: 0.25em; }
  .control &gt; div &gt; span.a { background: white; }
  .control &gt; div &gt; span.b { background: silver; }
  .control &gt; div &gt; span.c { background: yellow; cursor: crosshair; }
  .control &gt; div &gt; span.d { background: green; color: white; padding: 0.25em; margin: 0; }
  .control &gt; div &gt; span.green { outline: solid thick green; }
  .control &gt; div &gt; span.yellow { outline: solid thick yellow; }
  .control &gt; div &gt; span.blue { outline: solid thick blue; background: red; }

</pre>
   <pre class="rules">
  &lt;div&gt;

   &lt;p&gt;Select everything in this document. The following two constructs
   (in the thick black borders) should end up looking identical. You
   should also check that the cursor is the same on equivalent parts
   (in particular the cursor should be a crosshair over &amp;quot;Tree&amp;quot; and the
   default everywhere else.)&lt;/p&gt;

   &lt;table&gt;
    &lt;tr&gt;
     &lt;td class=&quot;test&quot;&gt;

      &lt;div&gt;
       &lt;span&gt;Cascadable&lt;/span&gt;
       &lt;span id=&quot;b&quot;&gt;Advanced&lt;/span&gt;
       &lt;span&gt;Tree&lt;/span&gt;
       &lt;span&gt;Selectors&lt;/span&gt;
       &lt;span&gt;&lt;!-- empty --&gt;&lt;/span&gt;
       &lt;span&gt;for &lt;strong&gt;CSS&lt;/strong&gt;&lt;/span&gt;
      &lt;/div&gt;

     &lt;/td&gt;
     &lt;td class=&quot;control&quot;&gt;

      &lt;div&gt;
       &lt;span class=&quot;a green&quot;&gt;Cascadable&lt;/span&gt;
       &lt;span class=&quot;b yellow&quot;&gt;Advanced&lt;/span&gt;
       &lt;span class=&quot;c green&quot;&gt;Tree&lt;/span&gt;
       &lt;span class=&quot;d yellow&quot;&gt;Selectors&lt;/span&gt;
       &lt;span class=&quot;e blue&quot;&gt;&lt;/span&gt;
       &lt;span class=&quot;f yellow&quot;&gt;for &lt;strong&gt;CSS&lt;/strong&gt;&lt;/span&gt;
      &lt;/div&gt;

     &lt;/td&gt;
    &lt;/tr&gt;
   &lt;/table&gt;
  &lt;/div&gt;
</pre>
  </div>
 </body>
</html>