View Full Version : Stylesheet switcher in WebKit 534

12-15-2011, 10:08 AM
I have a stylesheet switcher which works fine in all mainstream browsers until Safari 5.1 and possibly a past version of Chrome. The source of the problem appears to be in WebKit version 534. Other designers have experienced similar problems:

This version of WebKit appears not to action:

a.disabled = false
in the following script.

function changeLayout(description){
var i, a;
for(i=0; (a = document.getElementsByTagName("link")[i]); i++){
if(a.getAttribute("title") == description){a.disabled = false;}
else if(a.getAttribute("title") != "default"){a.disabled = true;}

(or perhaps it may be the case that it will only allow one active stylesheet, the default?)

I have alternative code I can deliver to switch the stylesheet but it is more onerous and I only want to run it if the usual method would fail.

Is there a way I could test if the browser is respecting "a.disabled = false" (or "true" for that matter)
and then deliver the alternative code if not?

OR is there a reliable way to test for WebKit version 534?

Thanks in advance.