CSS 3 Module | <== Test # ==> | |
---|---|---|
W3C Selectors | 147 of 153 | |
Testing | Date | Revision |
Dynamic updating of :first-child and :last-child (ID #d4) | 21-november-2001 | 1.0 |
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> 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>