Skip to content

Commit ac764df

Browse files
Handle noscript style with "js" class on <html>.
1 parent ca5c6f6 commit ac764df

File tree

4 files changed

+9
-4
lines changed

4 files changed

+9
-4
lines changed

util/gh-pages/index_template.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
<link id="styleNight" rel="stylesheet" href="https://rust-lang.github.io/mdBook/tomorrow-night.css" disabled="true"> {# #}
2525
<link id="styleAyu" rel="stylesheet" href="https://rust-lang.github.io/mdBook/ayu-highlight.css" disabled="true"> {# #}
2626
<link rel="stylesheet" href="style.css"> {# #}
27-
<noscript><link rel="stylesheet" href="noscript.css"></noscript> {# #}
2827
</head> {# #}
2928
<body> {# #}
3029
<script src="theme.js"></script> {# #}

util/gh-pages/noscript.css

Lines changed: 0 additions & 3 deletions
This file was deleted.

util/gh-pages/style.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,11 @@ details[open] {
230230
}
231231
}
232232

233+
html:not(.js) #settings-dropdown,
234+
html:not(.js)#menu-filters {
235+
display: none;
236+
}
237+
233238
#settings-dropdown {
234239
position: absolute;
235240
margin: 0.7em;

util/gh-pages/theme.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ function setTheme(theme, store) {
4545
}
4646

4747
(function() {
48+
// This file is loaded first. If so, we add the `js` class on the `<html>`
49+
// element.
50+
document.documentElement.classList.add("js");
51+
4852
// loading the theme after the initial load
4953
const prefersDark = window.matchMedia("(prefers-color-scheme: dark)");
5054
const theme = loadValue("theme");

0 commit comments

Comments
 (0)