Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / dom / css-dom-read.html
blob99b192faf82f72d2eed31e713532e41ffa8dedd7
1 <html>
2 <head>
3 <style>.one { display: block; }
4 .two { display: inline; }
5 .three { display: list-item; list-style-type: square; margin-left: 3em; }
6 .four { display: none; color: red; }
7 I { display: block; }
8 </style>
9 <script>
10 function test() {
11 if (window.testRunner)
12 testRunner.dumpAsText();
14 t = document.createTextNode(document.getElementsByTagName('style').item(0).firstChild.nodeValue);
15 document.getElementById('docStyle').appendChild(t);
17 styleSheet = document.styleSheets.item(0)
19 s = ""
20 for (i = 0; i < styleSheet.cssRules.length; i++) {
21 rule = styleSheet.cssRules.item(i);
22 switch (rule.type) {
23 case CSSRule.STYLE_RULE:
24 s += rule.selectorText + ' { ';
25 style = rule.style;
26 for (j = 0; j < style.length; j++) {
27 s += style.item(j) + ': ' + style.getPropertyValue(style.item(j))+ '; ';
29 s += '}\n';
33 document.getElementById('serializedStyle').appendChild(document.createTextNode(s));
35 </script>
36 </head>
37 <body onload="test();">
38 <div>Style as specified in the style element:</div>
39 <pre id="docStyle"></pre>
40 <div>Serialized style, using CSS DOM:</div>
41 <pre id="serializedStyle"></pre>
42 </body>
43 </html>