css3-modsel-d2.xml (1120B)
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"> 3 <head> 4 <title>Dynamic handling of combinators</title> 5 <style type="text/css"><![CDATA[ 6 #test { background: red; display: block; padding: 1em; } 7 #stub ~ div div + div > div { background: lime; } 8 ]]></style> 9 <link rel="author" title="Ian Hickson" href="mailto:ian@hixie.ch"/> 10 <link rel="help" href="https://www.w3.org/TR/css3-selectors/#selectors"/> <!-- bogus link to make sure it gets found --> 11 <meta name="flags" content=" dom" /> 12 </head> 13 <body> 14 15 <div> 16 17 18 <script type="text/javascript"> 19 <![CDATA[ 20 21 function test() { 22 el = document.getElementById('test'); 23 el.parentNode.parentNode.insertBefore(document.createElementNS('http://www.w3.org/1999/xhtml', 'div'), el.parentNode); 24 } 25 26 window.setTimeout("test()", 100); 27 ]]> 28 </script> 29 30 31 32 33 <p> The following bar should be green. </p> 34 35 <div id="stub"></div> 36 <div></div> 37 <div><div><!-- <div/> --><div><div id="test"></div></div></div></div> 38 39 </div> 40 41 </body> 42 </html>