From f55e986a713eb683f9629b26f0b2b6d5a3d61692 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Mon, 29 Oct 2018 23:25:35 +0100 Subject: [PATCH] Fix invalid "expand description" display --- src/librustdoc/html/static/main.js | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js index 3174c1be3adc8..b31100716397b 100644 --- a/src/librustdoc/html/static/main.js +++ b/src/librustdoc/html/static/main.js @@ -2088,7 +2088,7 @@ return wrapper; } - var hideItemDeclarations = getCurrentValue('rustdoc-item-declarations') === "false"; + var showItemDeclarations = getCurrentValue('rustdoc-item-declarations') === "false"; function buildToggleWrapper(e) { if (hasClass(e, 'autohide')) { var wrap = e.previousElementSibling; @@ -2117,7 +2117,7 @@ if (hasClass(e, "type-decl")) { fontSize = "20px"; otherMessage = ' Show declaration'; - if (hideItemDeclarations === false) { + if (showItemDeclarations === false) { extraClass = 'collapsed'; } } else if (hasClass(e, "sub-variant")) { @@ -2136,12 +2136,13 @@ extraClass = "marg-left"; } - e.parentNode.insertBefore(createToggle(otherMessage, - fontSize, - extraClass, - hideItemDeclarations), - e); - if (otherMessage.length > 0 && hideItemDeclarations === true) { + e.parentNode.insertBefore( + createToggle(otherMessage, + fontSize, + extraClass, + hasClass(e, "type-decl") === false || showItemDeclarations === true), + e); + if (hasClass(e, "type-decl") === true && showItemDeclarations === true) { collapseDocs(e.previousSibling.childNodes[0], "toggle"); } }