1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2 <html xmlns="http://www.w3.org/1999/xhtml">
4 <title>Dynamic updating of :first-child and :last-child</title>
5 <style type="text/css"><![CDATA[
6 #two:first-child { background: red; }
7 #three:last-child { background: lime; }
9 <link rel="first" href="css3-modsel-1.xml" title="Groups of selectors"/>
10 <link rel="prev" href="css3-modsel-d3.xml" title="Dynamic handling of attribute selectors"/>
11 <link rel="up" href="./index.html"/>
12 <link rel="top" href="../../index.html"/>
18 <script type="text/javascript">
22 el2 = document.getElementById('two');
23 el3 = document.getElementById('three');
24 el2.parentNode.insertBefore(el3.nextSibling, el2);
31 <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>