about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-12-16 18:40:10 +0000
committerbors <bors@rust-lang.org>2018-12-16 18:40:10 +0000
commit19dc2caf71d5df30d9214517efa1e6c203e337b1 (patch)
tree151dad2e9dcbc8cc2313a3f1a6584e70b29d6e02
parent748d354af3145d4292ea84142f73bb8114e3db12 (diff)
parentfa9c8232d74be77a0f214b7e650acad43994dbbe (diff)
downloadrust-19dc2caf71d5df30d9214517efa1e6c203e337b1.tar.gz
rust-19dc2caf71d5df30d9214517efa1e6c203e337b1.zip
Auto merge of #56876 - GuillaumeGomez:fix-JS-errors, r=QuietMisdreavus
Fix js errors

Fix JS error (you can see it on the iterator doc page) and the invalid theme switch.

r? @QuietMisdreavus
-rw-r--r--src/librustdoc/html/render.rs6
-rw-r--r--src/librustdoc/html/static/main.js4
-rw-r--r--src/librustdoc/html/static/storage.js2
3 files changed, 6 insertions, 6 deletions
diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs
index c9f3aa011a1..46002c089cf 100644
--- a/src/librustdoc/html/render.rs
+++ b/src/librustdoc/html/render.rs
@@ -868,10 +868,10 @@ themePicker.onblur = handleThemeButtonsBlur;
     }
 
     {
-        let mut data = static_files::STORAGE_JS.to_owned();
-        data.push_str(&format!("var resourcesSuffix = \"{}\";", cx.shared.resource_suffix));
         write_minify(cx.dst.join(&format!("storage{}.js", cx.shared.resource_suffix)),
-                     &data,
+                     &format!("var resourcesSuffix = \"{}\";{}",
+                              cx.shared.resource_suffix,
+                              static_files::STORAGE_JS),
                      options.enable_minification)?;
     }
 
diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js
index 51714c35d6f..d5b8ecd4807 100644
--- a/src/librustdoc/html/static/main.js
+++ b/src/librustdoc/html/static/main.js
@@ -213,9 +213,9 @@ if (!DOMTokenList.prototype.remove) {
     function expandSection(id) {
         var elem = document.getElementById(id);
         if (elem && isHidden(elem)) {
-            var h3 = elem.parentNode.previousSibling;
+            var h3 = elem.parentNode.previousElementSibling;
             if (h3 && h3.tagName !== "H3") {
-                h3 = h3.previousSibling; // skip div.docblock
+                h3 = h3.previousElementSibling; // skip div.docblock
             }
 
             if (h3) {
diff --git a/src/librustdoc/html/static/storage.js b/src/librustdoc/html/static/storage.js
index d1c377bf95a..22ac52f8728 100644
--- a/src/librustdoc/html/static/storage.js
+++ b/src/librustdoc/html/static/storage.js
@@ -111,7 +111,7 @@ function switchTheme(styleElem, mainStyleElem, newTheme) {
 
     var found = false;
     if (savedHref.length === 0) {
-        onEach(document.getElementsByTagName("link"), function(el) {
+        onEachLazy(document.getElementsByTagName("link"), function(el) {
             savedHref.push(el.href);
         });
     }