chromium - Alternate stylesheet switching in both Chrome and Firefox -
i'm encountering weird inconsistent behavior between chromium 53 , firefox 49 when switching between stylesheets.
my stylesheets added this:
<link class="alternate-style" rel="stylesheet" title="carbon" type="text/css" href="assets/css/alt/carbon.css" /> ...
the switcher works this:
function setstyle(style) { $('link.alternate-style') .prop('disabled', 'disabled') .filter(function() { return this.title == style; }) .removeattr('disabled'); }
(setstyle() called on startup default value.)
this worked in firefox , chromium without problems late jquery 2.2.4.
now i'm trying upgrade jquery 3.1.1.
in chromium, there's no problem @ - in firefox, won't work after upgrade. stylesheets disabled, , style-changer won't anything.
suspecting removeattr() has changed (jquery differentiates between attributes , properties more strictly), changed setstyle following seemed cleaner in case:
function setstyle(style) { $('link.alternate-style').prop('disabled', function() { return this.title != style; }); }
now works in firefox, not in chromium! bug different - style-switcher works fine, initializer broken , page unstyled.
summary: in 2.2.4, both versions of code work. in 3.1.1, old code works in chromium not firefox, while new code works in firefox not chromium.
by testing, isolated part of code work in both browsers:
function setstyle(style) { $('link.alternate-style') .prop('disabled', true) // <-- necessary chromium .prop('disabled', function() { return this.title != style; }); }
that line seems redundant - property overridden again. commenting out breaks initialization in chromium.
update: testing latest dev build of chromium 56, appears chromium bug has since been fixed.
Comments
Post a Comment