<?xml-stylesheet href="../../../style/xml-full.css" type="text/css"?>
<?xml-stylesheet href="css3-modsel-d4.css" type="text/css"?>
<test xmlns:xlink="http://www.w3.org/1999/xlink">
 <title>Dynamic updating of :first-child and :last-child</title>
 <author>Ian Hickson</author>
 <metadata>
  <item> <name>CSS 3 Module</name> <data>W3C Selectors</data> </item>
  <item> <name>Previous</name> <data xlink:type="simple" xlink:href="css3-modsel-d3.xml">Dynamic handling of attribute selectors</data> </item>
  <item> <name>Test #</name> <data>296 of 296</data> </item>
  <item> <name>Testing</name> <data>Dynamic updating of :first-child and :last-child</data> </item>
  <item> <name>ID</name> <data>d4</data> </item>
  <item> <name>Date</name> <data>2004-03-03</data> </item>
  <item> <name>Revision</name> <data>1.1</data> </item>
 </metadata>
   <requirement>The UA must support ECMA-262 and DOM Level 2 Core for this test.</requirement>
  <content>

 <div xmlns="http://www.w3.org/1999/xhtml">

  <script type="text/javascript">
   <![CDATA[

    function test() {
      el2 = document.getElementById('two');
      el3 = document.getElementById('three');
      el2.parentNode.insertBefore(el3.nextSibling, el2);
    }

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

  <div><p id="two">This line should be unstyled. (2)</p><p id="three">This line should have a green background. (3)</p><p>This line should be unstyled. (4 moving to 1)</p></div>

 </div>

</content>
  <source>
   <css>
   #two:first-child { background: red; }
   #three:last-child { background: lime; }
</css>
   <xml>

 &lt;div xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;

  &lt;script type=&quot;text/javascript&quot;&gt;
   &lt;![CDATA[

    function test() {
      el2 = document.getElementById(&#39;two&#39;);
      el3 = document.getElementById(&#39;three&#39;);
      el2.parentNode.insertBefore(el3.nextSibling, el2);
    }

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

  &lt;div&gt;&lt;p id=&quot;two&quot;&gt;This line should be unstyled. (2)&lt;/p&gt;&lt;p id=&quot;three&quot;&gt;This line should have a green background. (3)&lt;/p&gt;&lt;p&gt;This line should be unstyled. (4 moving to 1)&lt;/p&gt;&lt;/div&gt;

 &lt;/div&gt;

</xml>
  </source>
</test>