| <csstest def="Dynamic updating of :first-child and :last-child" module="W3C Selectors" modulename="css3-modsel" number="d4" rev="1.1" date="3-march-2004" xmlns="http://www.example.org/css3tests"> |
| |
| <author>Ian Hickson</author> |
| |
| <dynamic/> |
| |
| <cssrules> |
| #two:first-child { background: red; } |
| #three:last-child { background: lime; } |
| </cssrules> |
| |
| <code> |
| |
| <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> |
| |
| </code> |
| </csstest> |