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; }
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)
20 for (i
= 0; i
< styleSheet
.cssRules
.length
; i
++) {
21 rule
= styleSheet
.cssRules
.item(i
);
23 case CSSRule
.STYLE_RULE
:
24 s
+= rule
.selectorText
+ ' { ';
26 for (j
= 0; j
< style
.length
; j
++) {
27 s
+= style
.item(j
) + ': ' + style
.getPropertyValue(style
.item(j
))+ '; ';
33 document
.getElementById('serializedStyle').appendChild(document
.createTextNode(s
));
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>