RESOLVED FIXED Bug 14462
empty <style> element doesn't get a StyleSheet object
https://bugs.webkit.org/show_bug.cgi?id=14462
Summary empty <style> element doesn't get a StyleSheet object
Derk-Jan Hartman
Reported 2007-06-29 12:41:14 PDT
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.
Attachments
First attempt (10.09 KB, patch)
2007-07-14 10:59 PDT, Rob Buis
mjs: review+
Rob Buis
Comment 1 2007-07-14 10:59:22 PDT
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.
Maciej Stachowiak
Comment 2 2007-07-16 00:04:40 PDT
Comment on attachment 15516 [details] First attempt r=me
Mark Rowe (bdash)
Comment 3 2007-07-16 01:42:22 PDT
I landed this for Rob in r24302.
Alexey Proskuryakov
Comment 4 2010-11-10 13:13:55 PST
I've reverted this fix for bug 45205, but its regression test still passes with ToT.
Note You need to log in before you can comment on or make changes to this bug.