<html> | |
<head> | |
<style> | |
.unchanged + #test | |
{ | |
background-color:red | |
} | |
.changed + #test | |
{ | |
background-color:green; | |
} | |
#test { | |
width:100px; | |
height:100px; | |
} | |
</style> | |
</head> | |
<body> | |
There should be a 100x100 green block below. | |
<div class="unchanged" id="beforetest"></div> | |
<div id="test"></div> | |
<script> | |
document.body.offsetWidth; | |
document.getElementById('beforetest').className = 'changed'; | |
document.body.offsetWidth; | |
</script> | |
</body> | |
</html> | |