May 28, 2003
Konqueror and Safari [KHTML] incorrectly only populate the document.styleSheets collection with stylesheets that are enabled at any particular instant. The stylesheets cannot be disabled from here, and do not have the title property.
Bummer. However, as is common with many things programmatic, all is not entirely lost. The article goes on to say that even if the document.styleSheets collection is not supported (or improperly supported) it still may be possible to get an equivalent disabling or switching action by referencing the
<style> tags instead. This isn’t the W3C recommended way of doing things, but you need to work with what you got. Half way is better than no way, I suppose. The most usable bit of scripting my friend John Charlton and I have been able to jury rig so far will toggle linked stylesheets, but not inline stylesheets — those confined within the
<style> tags or using
Toggle Linked CSS
Well, it’s a start. And to be completely honest, John hacked it together — I just made it look pretty. What else is new? Additional contributions and tweakage will be gratefully accepted. Now, if you don’t mind, I’m off to drop a couple of very specific bug fix request into Dave Hyatt’s mailbox.
This item was posted by.
Leave a comment or send a trackback from your own site.