Skip to content

Commit d0f88c4

Browse files
Prevent automatic collapse of methods impl blocks
1 parent 19f8958 commit d0f88c4

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

src/librustdoc/html/static/main.js

+20-2
Original file line numberDiff line numberDiff line change
@@ -1887,12 +1887,30 @@ if (!DOMTokenList.prototype.remove) {
18871887
updateLocalStorage("rustdoc-collapse", "true");
18881888
addClass(innerToggle, "will-expand");
18891889
onEveryMatchingChild(innerToggle, "inner", function(e) {
1890-
e.innerHTML = labelForToggleButton(true);
1890+
var parent = e.parentNode;
1891+
var superParent = null;
1892+
1893+
if (parent) {
1894+
superParent = parent.parentNode;
1895+
}
1896+
if (!parent || !superParent || superParent.id !== "main" ||
1897+
hasClass(parent, "impl") === false) {
1898+
e.innerHTML = labelForToggleButton(true);
1899+
}
18911900
});
18921901
innerToggle.title = "expand all docs";
18931902
if (fromAutoCollapse !== true) {
18941903
onEachLazy(document.getElementsByClassName("collapse-toggle"), function(e) {
1895-
collapseDocs(e, "hide", pageId);
1904+
var parent = e.parentNode;
1905+
var superParent = null;
1906+
1907+
if (parent) {
1908+
superParent = parent.parentNode;
1909+
}
1910+
if (!parent || !superParent || superParent.id !== "main" ||
1911+
hasClass(parent, "impl") === false) {
1912+
collapseDocs(e, "hide", pageId);
1913+
}
18961914
});
18971915
}
18981916
}

0 commit comments

Comments
 (0)