about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2019-02-04 14:59:06 +0100
committerGuillaume Gomez <guillaume1.gomez@gmail.com>2019-02-04 14:59:06 +0100
commitd0f88c4da31b3a3ff2a0b62342b3d36e0c0bd6cf (patch)
treeb09a770fa0926ef2a92d5a93ced63d786c4ae88a
parent19f8958f827e379be9b0ffc93fca580ec8ffac77 (diff)
downloadrust-d0f88c4da31b3a3ff2a0b62342b3d36e0c0bd6cf.tar.gz
rust-d0f88c4da31b3a3ff2a0b62342b3d36e0c0bd6cf.zip
Prevent automatic collapse of methods impl blocks
-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 82604cc7ad8..631d8236464 100644
--- a/src/librustdoc/html/static/main.js
+++ b/src/librustdoc/html/static/main.js
@@ -1887,12 +1887,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);
+                    }
                 });
             }
         }