HTMLLinkElement.disabled = false; doesn't enable alternate stylesheet when changed the first time
Reported by stephan....@helionweb.de, May 17 2018
UserAgent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/65.0.3325.181 Chrome/65.0.3325.181 Safari/537.36 Steps to reproduce the problem: 1. Download all files and put them in the same directory 2. Open switch_once.html 3. The text is displayed in black (unstyled) What is the expected behavior? The text should be displayed in green (the alternate stylesheet should be used). What went wrong? Enabling the alternate stylesheet by setting the link elements "disabled" attribute to false doesn't work at first (HTMLLinkElement interface). Doesn't work: link_element.disabled = false; But the following code works: link_element.disabled = false; link_element.disabled = true; link_element.disabled = false; This is only necessary once after the page is loaded. After that setting the attribute once works properly. Did this work before? N/A Does this work in other browsers? Yes Chrome version: 65.0.3325.181 Channel: stable OS Version: Linux Mint 17 Qiana Flash Version: Also tested in Firefox 60 Win7 (works), IE 10 Win7 (works) and Chrome 66 Win7 (doesn't work). Doesn't make a difference if the code is opened as a local file (file://...) or via HTTP. Using link_element.sheet.disabled (StyleSheet interface) doesn't help either. The same also happens when the code is executed at "DOMContentLoaded" instead of "load" or when the code is manually executed in the console. It's independent of event timing. Both HTML files contain commented out workaround code that make it work. I also included an interactive switcher (interactive_switcher.html) as that's how I stumbled over the bug. When you first switch to the "green" style the normal stylesheet gets disabled but the alternate stylesheet isn't enabled. But when switching back to blue and then to green again it works.
May 17 2018,
Not sure where to put this, but these two issues might be related: https://bugs.webkit.org/show_bug.cgi?id=25287 https://bugs.chromium.org/p/chromium/issues/detail?id=695984
May 17 2018,
May 21 2018,
Able to reproduce this issue on Windows 10, Linux & Mac 10.13.3 with chrome Stable #66.0.3359.181, Beta #67.0.3396.48, Dev #68.0.3432.3, Canary #68.0.3436.0 and also on earlier version M60-#60.0.3072.0 This is a non-regression issue, hence marking it as untiraged Attaching the screen-shot for reference.
May 22 2018,
May 25 2018,
I just found out that the workaround can be simplified a bit. This code is enough to switch between two styles: blue_style.disabled = true; green_style.disabled = true; // workaround green_style.disabled = false; Seems like executing green_style.disabled = true; once is enough to "fix" the bug. Even if the stylesheet is already disabled (because it's an alternate stylesheet). Maybe that helps narrowing down the bug.
Sign in to add a comment