This is turning up null all of a sudden. I'm running version 5.0.375.70
alert(document.styleSheets[0].cssRules);
shows null in chrome with a very simple test page and single css file with just one rule, but turns up as an CSSRuleList for FF Safari, Opera etc...
document.styleSheets[0].rules is also null in my Chrome browser. How do i get the css rules in chrome? I think this actually used to work in my older versions of chrome but now I'm second guessing myself.
odd, when i uploaded it to my webserver it worked. my server is unix, my pc is windows, so i tried changing it from href='test.css' to href='/test.css' and that fixed it locally
Its a good bet that Ims is using the file: protocol to test his code.
I usually work on a server, and have had no troubles with any of the Chromes and their styleSheets methods.
When I opened a page from the file system Chrome was the only browser that would not expose some of the styleSheets rule sets, although it could find every styleSheet loaded.
It seems to be a file permissions weirdness, though not even Safari 5 shares it.
Test your code on a local server with http: instead of the file system. It's the only way to use IE without getting a migraine, but all the browsers are really built for http.
Bookmarks