<?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>Dynamic handling of combinators</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[
   #test { background: red; display: block; padding: 1em; }
   #stub ~ div div + div > div { background: lime; }
]]></style>
  <link rel="first" href="css3-modsel-d1.xml" title="NEGATED Dynamic handling of :empty"/>
  <link rel="prev" href="css3-modsel-d1b.xml" title="NEGATED Dynamic handling of :empty"/>
  <link rel="next" href="css3-modsel-d3.xml" title="Dynamic handling of attribute selectors"/>
  <link rel="last" href="css3-modsel-d4.xml" title="Dynamic updating of :first-child and :last-child"/>
  <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-d1b.xml" title="NEGATED Dynamic handling of :empty">&lt;==</a>
     Test #
     <a href="css3-modsel-d3.xml" title="Dynamic handling of attribute selectors">==&gt;</a>
    </th>
   </tr>
   <tr>
    <td class="b">W3C Selectors</td>
    <td class="c" colspan="2">3 of 5 of the dynamic 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">Dynamic handling of combinators (ID #d2)</td>
    <td class="a">14-november-2001</td>
    <td class="a">1.0</td>
   </tr>
  </table>
  <p class="WARNING">NOTE: The UA must support ECMA-262 and DOM Level 2 Core for this test.</p>
  <div class="testSource">
   <div class="testText">

 <div>

  
  <script>
   <![CDATA[

    function test() {
      el = document.getElementById('test');
      el.parentNode.parentNode.insertBefore(document.createElementNS('http://www.w3.org/1999/xhtml', 'div'), el.parentNode);
    }

    window.setTimeout(test, 100);
   ]]>
  </script>
  

  

  <p onclick="test()"> The following bar should be green. </p>

  <div id="stub"></div>
  <div></div>
  <div><div><!-- <div/> --><div><div id="test"></div></div></div></div>

 </div>

</div>
   <pre class="rules">
   #test { background: red; display: block; padding: 1em; }
   #stub ~ div div + div &gt; div { background: lime; }
</pre>
   <pre class="rules">

 &lt;div&gt;

  
  &lt;script&gt;
   &lt;![CDATA[

    function test() {
      el = document.getElementById(&#39;test&#39;);
      el.parentNode.parentNode.insertBefore(document.createElementNS(&#39;http://www.w3.org/1999/xhtml&#39;, &#39;div&#39;), el.parentNode);
    }

    window.setTimeout(test, 100);
   ]]&gt;
  &lt;/script&gt;
  

  

  &lt;p onclick=&quot;test()&quot;&gt; The following bar should be green. &lt;/p&gt;

  &lt;div id=&quot;stub&quot;&gt;&lt;/div&gt;
  &lt;div&gt;&lt;/div&gt;
  &lt;div&gt;&lt;div&gt;&lt;!-- &lt;div/&gt; --&gt;&lt;div&gt;&lt;div id=&quot;test&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;

 &lt;/div&gt;

</pre>
  </div>
 </body>
</html>