I was trying to do the following in Javascript var stylesheet = document.createElement('style'); stylesheet.type = 'text/css'; stylesheet.rel = 'stylesheet'; document.getElementsByTagName("head")[0].appendChild(stylesheet); var styles = stylesheet.sheet ? stylesheet.sheet : stylesheet.styleSheet; However this would not work, when testing the value styles, it was null. With help from mitzpettel on #webkit IRC it was determined I needed to add: stylesheet.appendChild(document.createTextNode()); before appending the new style-element to the head-element.
Created attachment 15516 [details] First attempt This should fix the problem. I still don't like the StyleElement class 100%, but I think its a bit better now... Cheers, Rob.
Comment on attachment 15516 [details] First attempt r=me
I landed this for Rob in r24302.
I've reverted this fix for bug 45205, but its regression test still passes with ToT.