rendered paste body<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><html xmlns="http://www.w3.org/1999/xhtml" version="-//W3C//DTD XHTML 1.1//EN" xml:lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <title>CSS Test</title> <script type='text/javascript; e4x=1'> <![CDATA[ function init() { var newStyleNode = document.createElementNS("http://www.w3.org/2000/svg", 'svg:style'); newStyleNode.setAttributeNS(null, 'id', 'svgRoot:selectRectStyle'); document.getElementById('svgRoot:defs').appendChild(newStyleNode); var cdata = document.createCDATASection("rect.selectRectStyle{ fill: red; }"); newStyleNode.appendChild(cdata); document.getElementById('greenRect').setAttributeNS(null, 'class', 'selectRectStyle'); } ]]> </script> </head> <body onload='init();'> <svg:svg id='svgRoot' xmlns:svg='http://www.w3.org/2000/svg' version='1.1' width='1000' height='400'> <svg:defs id='svgRoot:defs'> </svg:defs> <svg:rect id='greenRect' x="400" y="150" width="200" height="100" /> </svg:svg> </body></html>