<svg xmlns="http://www.w3.org/2000/svg">
<style type="text/css">
.fail {fill: red;}
.pass {fill: green;}
</style>
<rect width="100" height="100" id="test" class="fail"/>
<script>
document.getElementById('test').className.baseVal = 'pass';
</script>
</svg>