W3C DOM tests - styleSheet tests

This is element x. It has inline style border: 1px solid #cc0000. Element y is the test style sheet.

Test scripts

styleSheet

alert(document.styleSheets.length);

cssRules

Should be 2

alert(y.cssRules.length);

Should be undefined (it’s an @import rule).

alert(y.cssRules[0].selectorText);

Should be p#test,ul.

alert(y.cssRules[y.cssRules.length-1].selectorText);

rules

Should be 2

alert(y.rules.length);

Should be undefined (it’s an @import rule).

alert(y.rules[0].selectorText);

Should be p#test,ul.

alert(y.rules[y.rules.length-1].selectorText);

imports

alert(y.imports.length);