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

cssText

alert(x.style.cssText)
alert(y.cssText)

The next two tests are for W3C-compliant browsers.

alert(y.cssRules[y.cssRules.length-1].cssText)
alert(y.cssRules[y.cssRules.length-1].style.cssText)

The next two tests are for IE.

alert(y.rules[y.rules.length-1].cssText)
alert(y.rules[y.rules.length-1].style.cssText)

disabled

y.disabled = !y.disabled
alert(y.disabled)

href

alert(y.href)

teststyleSheet2.css does not contain a color rule. Instead it contains p#test {font-size: 130%;}.

y.href = 'teststyleSheet2.css'

selectorText

Correct: p#test, ul.

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

Let's see if you can set the selectorText.

y.cssRules[y.cssRules.length-1].selectorText = 'pre'
y.rules[y.rules.length-1].selectorText = 'pre'