2007-10-08 Eric Seidel <eric@webkit.org>
[WebKit-https.git] / LayoutTests / svg / css / getComputedStyle-basic.xhtml
1 <html xmlns="http://www.w3.org/1999/xhtml">
2   <body>
3     <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
4       <g id="g" stroke="orange" stroke-width="2px">
5         <rect id="rect" width="100" height="100" fill="blue" />
6       </g>
7     </svg>
8     <div id="log"></div>
9     <script><![CDATA[
10       if (window.layoutTestController)
11           layoutTestController.dumpAsText();
12
13       function debugLog(s) {
14         var logDiv = document.getElementById("log");
15         logDiv.appendChild(document.createTextNode(s));
16         logDiv.appendChild(document.createElementNS("http://www.w3.org/1999/xhtml", "br"));
17       }
18
19       function printStyle(elementId) {
20         var element = document.getElementById(elementId);
21         var style = document.defaultView.getComputedStyle(element);
22       
23         for (var x = 0; x < style.length; x++) {
24           var name = style.item(x);
25           var value = style.getPropertyValue(name);
26           var cssValue = style.getPropertyCSSValue(name);
27   
28           debugLog(elementId + ": style.getPropertyValue(" + name + ") : " + value);
29           debugLog(elementId + ": style.getPropertyCSSValue(" + name + ") : " + cssValue);
30         }
31       }
32       
33       printStyle("rect");
34       printStyle("g");
35     ]]></script>
36   </body>
37 </html>