about summary refs log tree commit diff
diff options
context:
space:
mode:
authorkennytm <kennytm@gmail.com>2018-03-14 16:29:43 +0800
committerkennytm <kennytm@gmail.com>2018-03-15 00:15:45 +0800
commitc65ee94365b3a3545b9eb77d4f528c56f19a23bd (patch)
tree9dcc3de4805df115f3b17e9702b3deb10ce4ae78
parent4ea78d4c844bfff0efbc5043efd04f40e44c9b01 (diff)
parent366ee8518fe53e821e809812ba80e7696861c93c (diff)
downloadrust-c65ee94365b3a3545b9eb77d4f528c56f19a23bd.tar.gz
rust-c65ee94365b3a3545b9eb77d4f528c56f19a23bd.zip
Rollup merge of #48831 - GuillaumeGomez:fix-theme-blink, r=QuietMisdreavus
Fix blink when main theme is selected

r? @QuietMisdreavus
-rw-r--r--src/librustdoc/html/static/storage.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/librustdoc/html/static/storage.js b/src/librustdoc/html/static/storage.js
index 7e9cfbd6763..c8571e4cf91 100644
--- a/src/librustdoc/html/static/storage.js
+++ b/src/librustdoc/html/static/storage.js
@@ -44,8 +44,12 @@ function switchTheme(styleElem, mainStyleElem, newTheme) {
     var fullBasicCss = "rustdoc" + resourcesSuffix + ".css";
     var fullNewTheme = newTheme + resourcesSuffix + ".css";
     var newHref = mainStyleElem.href.replace(fullBasicCss, fullNewTheme);
-    var found = false;
 
+    if (styleElem.href === newHref) {
+        return;
+    }
+
+    var found = false;
     if (savedHref.length === 0) {
         onEach(document.getElementsByTagName("link"), function(el) {
             savedHref.push(el.href);