| CSS 3 Module | <== Test # ==> | |
|---|---|---|
| W3C Selectors | 4 of 10 of the dynamic tests category | |
| Testing | Date | Revision | 
| Dynamic updating of :first-child and :last-child (ID #d4) | 2004-03-03 | 1.1 | 
NOTE: The UA must support ECMA-262 and DOM Level 2 Core for this test.
This line should be unstyled. (2)
This line should have a green background. (3)
This line should be unstyled. (4 moving to 1)
   #two:first-child { background: red; }
   #three:last-child { background: lime; }
   
 <div>
  <script type="text/javascript">
   
    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>