dynamic-sibling-combinator-001.xht (2172B)
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>CSS Test: Testing dynamic changes and the '+' combinator</title> 5 <link rel="author" title="Boris Zbarsky" href="mailto:bzbarsky@mit.edu"/> 6 <link rel="reviewer" title="Elika J. Etemad" href="http://fantasai.inkedblade.net/contact"/> 7 <link rel="help" href="http://www.w3.org/TR/CSS21/selector.html#adjacent-selectors"/> 8 <link rel="help" href="http://www.w3.org/TR/CSS21/selector.html#attribute-selectors"/> 9 <link rel="match" href="dynamic-sibling-combinator-001-ref.xht"/> 10 <meta name="flags" content="dom" /> 11 <meta name="assert" content="Dynamically changing an attribute should cause selectors using '+' to match as needed."/> 12 <style type="text/css"><![CDATA[ 13 div { color: red; } 14 [class=foo] + div { color: green; } 15 [class=foo] + div + div { color: green; } 16 [class=foo] + div + div + div { color: green; } 17 [class=foo] + div + div + div + div { color: green; } 18 [class=foo] + div + div + div + div + div { color: green; } 19 [class=foo] + div + div + div + div + div + div { color: green; } 20 [class=foo] + div + div + div + div + div + div + div { color: green; } 21 [class=foo] + div + div + div + div + div + div + div + div { color: green; } 22 [class=foo] + div + div + div + div + div + div + div + div + div { color: green; } 23 [class=foo] + div + div + div + div + div + div + div + div + div + div { color: green; } 24 ]]></style> 25 <script type="text/javascript"><![CDATA[ 26 window.onload = function() { 27 document.body.offsetWidth; 28 document.getElementById("test").className = "foo"; 29 } 30 ]]></script> 31 </head> 32 <body> 33 <div id="test"></div> 34 <div>This should be green</div> 35 <div>This should be green</div> 36 <div>This should be green</div> 37 <div>This should be green</div> 38 <div>This should be green</div> 39 <div>This should be green</div> 40 <div>This should be green</div> 41 <div>This should be green</div> 42 <div>This should be green</div> 43 <div>This should be green</div> 44 </body> 45 </html>