<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title>CSS Test: Testing dynamic changes and the '+' combinator</title> <link rel="author" title="Boris Zbarsky" href="mailto:bzbarsky@mit.edu"> <link rel="reviewer" title="Elika J. Etemad" href="http://fantasai.inkedblade.net/contact"> <link rel="help" href="http://www.w3.org/TR/CSS21/selector.html#adjacent-selectors"> <link rel="help" href="http://www.w3.org/TR/CSS21/selector.html#attribute-selectors"> <meta name="flags" content="dom"> <meta name="assert" content="Dynamically changing an attribute should cause selectors using '+' to match as needed."> <style type="text/css"> div { color: red; } [class=foo] + div { color: green; } [class=foo] + div + div { color: green; } [class=foo] + div + div + div { color: green; } [class=foo] + div + div + div + div { color: green; } [class=foo] + div + div + div + div + div { color: green; } [class=foo] + div + div + div + div + div + div { color: green; } [class=foo] + div + div + div + div + div + div + div { color: green; } [class=foo] + div + div + div + div + div + div + div + div { color: green; } [class=foo] + div + div + div + div + div + div + div + div + div { color: green; } [class=foo] + div + div + div + div + div + div + div + div + div + div { color: green; } </style> <script type="text/javascript"> window.onload = function() { document.body.offsetWidth; document.getElementById("test").className = "foo"; } </script> </head> <body> <div id="test"></div> <div>This should be green</div> <div>This should be green</div> <div>This should be green</div> <div>This should be green</div> <div>This should be green</div> <div>This should be green</div> <div>This should be green</div> <div>This should be green</div> <div>This should be green</div> <div>This should be green</div> </body> </html>