Skip to content

Commit 064b787

Browse files
Rollup merge of #58146 - GuillaumeGomez:dont-collapse-everything, r=QuietMisdreavus
Prevent automatic collapse of methods impl blocks Fixes #57582. r? @QuietMisdreavus
2 parents 2c9f1f5 + d0f88c4 commit 064b787

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
@@ -1886,12 +1886,30 @@ if (!DOMTokenList.prototype.remove) {
18861886
updateLocalStorage("rustdoc-collapse", "true");
18871887
addClass(innerToggle, "will-expand");
18881888
onEveryMatchingChild(innerToggle, "inner", function(e) {
1889-
e.innerHTML = labelForToggleButton(true);
1889+
var parent = e.parentNode;
1890+
var superParent = null;
1891+
1892+
if (parent) {
1893+
superParent = parent.parentNode;
1894+
}
1895+
if (!parent || !superParent || superParent.id !== "main" ||
1896+
hasClass(parent, "impl") === false) {
1897+
e.innerHTML = labelForToggleButton(true);
1898+
}
18901899
});
18911900
innerToggle.title = "expand all docs";
18921901
if (fromAutoCollapse !== true) {
18931902
onEachLazy(document.getElementsByClassName("collapse-toggle"), function(e) {
1894-
collapseDocs(e, "hide", pageId);
1903+
var parent = e.parentNode;
1904+
var superParent = null;
1905+
1906+
if (parent) {
1907+
superParent = parent.parentNode;
1908+
}
1909+
if (!parent || !superParent || superParent.id !== "main" ||
1910+
hasClass(parent, "impl") === false) {
1911+
collapseDocs(e, "hide", pageId);
1912+
}
18951913
});
18961914
}
18971915
}

0 commit comments

Comments
 (0)