Skip to content

Commit a0ce1e0

Browse files
committed
Always store Rustdoc theme when it's changed
1 parent 07a63e6 commit a0ce1e0

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

Diff for: src/librustdoc/html/static/storage.js

+6-5
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,12 @@ function switchTheme(styleElem, mainStyleElem, newTheme, saveTheme) {
9494
var fullNewTheme = newTheme + resourcesSuffix + ".css";
9595
var newHref = mainStyleElem.href.replace(fullBasicCss, fullNewTheme);
9696

97+
// If this new value comes from a system setting or from the previously
98+
// saved theme, no need to save it.
99+
if (saveTheme === true) {
100+
updateLocalStorage("rustdoc-theme", newTheme);
101+
}
102+
97103
if (styleElem.href === newHref) {
98104
return;
99105
}
@@ -112,11 +118,6 @@ function switchTheme(styleElem, mainStyleElem, newTheme, saveTheme) {
112118
});
113119
if (found === true) {
114120
styleElem.href = newHref;
115-
// If this new value comes from a system setting or from the previously
116-
// saved theme, no need to save it.
117-
if (saveTheme === true) {
118-
updateLocalStorage("rustdoc-theme", newTheme);
119-
}
120121
}
121122
}
122123

0 commit comments

Comments
 (0)