about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2019-02-07 14:28:38 +0100
committerGitHub <noreply@github.com>2019-02-07 14:28:38 +0100
commit064b787fc9c5074077d20d50387b91d12fc1e277 (patch)
tree2c0c816781e9a7288805d8911c99d0890a11bb4d
parent2c9f1f5750fcd65e8979d15c5fb5a21185765dc7 (diff)
parentd0f88c4da31b3a3ff2a0b62342b3d36e0c0bd6cf (diff)
downloadrust-064b787fc9c5074077d20d50387b91d12fc1e277.tar.gz
rust-064b787fc9c5074077d20d50387b91d12fc1e277.zip
Rollup merge of #58146 - GuillaumeGomez:dont-collapse-everything, r=QuietMisdreavus
Prevent automatic collapse of methods impl blocks

Fixes #57582.

r? @QuietMisdreavus
-rw-r--r--src/librustdoc/html/static/main.js22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js
index 60ee5c6f24b..5ea6cf6ddf8 100644
--- a/src/librustdoc/html/static/main.js
+++ b/src/librustdoc/html/static/main.js
@@ -1886,12 +1886,30 @@ if (!DOMTokenList.prototype.remove) {
             updateLocalStorage("rustdoc-collapse", "true");
             addClass(innerToggle, "will-expand");
             onEveryMatchingChild(innerToggle, "inner", function(e) {
-                e.innerHTML = labelForToggleButton(true);
+                var parent = e.parentNode;
+                var superParent = null;
+
+                if (parent) {
+                    superParent = parent.parentNode;
+                }
+                if (!parent || !superParent || superParent.id !== "main" ||
+                    hasClass(parent, "impl") === false) {
+                    e.innerHTML = labelForToggleButton(true);
+                }
             });
             innerToggle.title = "expand all docs";
             if (fromAutoCollapse !== true) {
                 onEachLazy(document.getElementsByClassName("collapse-toggle"), function(e) {
-                    collapseDocs(e, "hide", pageId);
+                    var parent = e.parentNode;
+                    var superParent = null;
+
+                    if (parent) {
+                        superParent = parent.parentNode;
+                    }
+                    if (!parent || !superParent || superParent.id !== "main" ||
+                        hasClass(parent, "impl") === false) {
+                        collapseDocs(e, "hide", pageId);
+                    }
                 });
             }
         }