Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Themes don't work in Chrome. #784

Closed
emilio opened this issue Sep 8, 2018 · 1 comment
Closed

Themes don't work in Chrome. #784

emilio opened this issue Sep 8, 2018 · 1 comment
Labels
A-Style Area: Style (CSS, etc.)

Comments

@emilio
Copy link

emilio commented Sep 8, 2018

Hey, so I was taking a quick look at rust-lang/rust-bindgen#1367, and realized that chrome rendered differently than Firefox the bindgen book.

Turns out that the theming stuff is not working in Chrome because chrome doesn't wait for stylesheets to load in order to execute script. You can see an example in:

<!doctype html>
<link rel="stylesheet" href="foo.css" onload="console.log('onload')">
<body>
<script>
  console.log("script");
</script>

(with an existing foo.css file). onload doesn't reliably get logged before script. You can see the testcase online in https://crisal.io/tmp/load-sheet.html. For me https://rust-lang-nursery.github.io/mdBook/cli/watch.html renders the code blocks dark on chrome, for example.

The reason why they don't work is because HTMLLinkElement.disabled, when called via the WebIDL setter, it doesn't do anything if HTMLLinkElement.sheet is null (this bit is compatible across browsers, but for more fun related to disabled and such I invite you to whatwg/html#3840 :)).

In any case, this should probably just use the rel attribute, using alternate stylesheet as the rel value for the disabled sheets. I think that should work everywhere.

@ehuss
Copy link
Contributor

ehuss commented May 28, 2023

Closing per the comment at #785 (comment), I can't reproduce this. Please comment, reopen, or open a new issue if there is a way to reproduce this now.

@ehuss ehuss closed this as not planned Won't fix, can't repro, duplicate, stale May 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Style Area: Style (CSS, etc.)
Projects
None yet
2 participants