1 <svg xmlns="http://www.w3.org/2000/svg" width="300" height="300" onload="test()">
2 <title>Creating elements and related interfaces</title>
3 <style type="text/css">
7 <rect width="150" height="300" class="fail"/>
8 <script type="text/javascript">
9 var r1 = document.createElementNS('http://www.w3.org/2000/svg', 'rect');
10 r1.width.baseVal.newValueSpecifiedUnits(r1.width.baseVal.SVG_LENGTHTYPE_PX, 300);
11 r1.height.baseVal.newValueSpecifiedUnits(r1.height.baseVal.SVG_LENGTHTYPE_PX, 150);
12 r1.setAttribute('class', 'pass');
13 r1.setAttribute('fill', 'red');
14 var r2 = document.createElementNS('http://www.w3.org/2000/svg', 'rect');
15 r2.width.baseVal.newValueSpecifiedUnits(r2.width.baseVal.SVG_LENGTHTYPE_PX, 300);
16 r2.height.baseVal.newValueSpecifiedUnits(r2.height.baseVal.SVG_LENGTHTYPE_PX, 150);
17 r2.setAttribute('y', '150');
18 document.documentElement.appendChild(r1);
20 r2.className.baseVal = 'pass';
21 document.documentElement.appendChild(r2);