diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js index 1a15a444a701a..a04eaa7f0b270 100644 --- a/src/librustdoc/html/static/main.js +++ b/src/librustdoc/html/static/main.js @@ -862,6 +862,12 @@ function hideThemeButtonState() { displayHelp(true, ev); }); + onEachLazy(document.getElementsByTagName("summary"), function(el) { + el.addEventListener("click", function() { + addClass(el, "used"); + }); + }); + onEachLazy(document.getElementsByTagName("a"), function(el) { // For clicks on internal links ( tags with a hash property), we expand the section we're // jumping to *before* jumping there. We can't do this in onHashChange, because it changes diff --git a/src/librustdoc/html/static/rustdoc.css b/src/librustdoc/html/static/rustdoc.css index 578e8ce5acbef..c429562348b66 100644 --- a/src/librustdoc/html/static/rustdoc.css +++ b/src/librustdoc/html/static/rustdoc.css @@ -580,7 +580,7 @@ nav.sub { .content .item-info { position: relative; - margin-left: 33px; + margin-left: 24px; /* same as .docblock */ margin-top: -13px; } @@ -588,14 +588,6 @@ nav.sub { margin-top: initial; } -.content .item-info::before { - content: '⬑'; - font-size: 25px; - position: absolute; - top: -6px; - left: -19px; -} - .content .impl-items .method, .content .impl-items > .type, .impl-items > .associatedconstant, .impl-items > .associatedtype, .content .impl-items details > summary > .type, .impl-items details > summary > .associatedconstant, @@ -1487,11 +1479,21 @@ details.rustdoc-toggle[open] > summary.hideme > span { display: none; } -details.rustdoc-toggle[open] > summary::before { +/* If a toggle has been used to open a section, we should make sure */ +/* there's a [-] so it can be closed again. But if a toggle is open */ +/* and has never been used, don't show it. This minimizes clutter on */ +/* the page while still supporting the "auto hide " settings and */ +/* the expand/collapse all functionality. */ +details.rustdoc-toggle[open] > summary.used::before { content: "[−]"; display: inline; } +details.rustdoc-toggle[open] > summary::before { + content: ""; + display: inline; +} + details.undocumented > summary::before { content: "[+] Show hidden undocumented items"; cursor: pointer; diff --git a/src/librustdoc/html/static/themes/ayu.css b/src/librustdoc/html/static/themes/ayu.css index d220d8708a123..034fd3151de21 100644 --- a/src/librustdoc/html/static/themes/ayu.css +++ b/src/librustdoc/html/static/themes/ayu.css @@ -165,8 +165,6 @@ pre, .rustdoc.source .example-wrap { color: #c5c5c5; } -.content .item-info::before { color: #ccc; } - .content span.foreigntype, .content a.foreigntype { color: #ef57ff; } .content span.union, .content a.union { color: #98a01c; } .content span.constant, .content a.constant, diff --git a/src/librustdoc/html/static/themes/dark.css b/src/librustdoc/html/static/themes/dark.css index 6385a763f2ef7..752ec81fcee27 100644 --- a/src/librustdoc/html/static/themes/dark.css +++ b/src/librustdoc/html/static/themes/dark.css @@ -138,8 +138,6 @@ a.result-static:focus { background-color: #0063cc; } a.result-primitive:focus { background-color: #00708a; } a.result-keyword:focus { background-color: #884719; } -.content .item-info::before { color: #ccc; } - .content span.enum, .content a.enum, .block a.current.enum { color: #82b089; } .content span.struct, .content a.struct, .block a.current.struct { color: #2dbfb8; } .content span.type, .content a.type, .block a.current.type { color: #ff7f00; } diff --git a/src/librustdoc/html/static/themes/light.css b/src/librustdoc/html/static/themes/light.css index c19d5bfc317f7..6ac824dd76c05 100644 --- a/src/librustdoc/html/static/themes/light.css +++ b/src/librustdoc/html/static/themes/light.css @@ -136,8 +136,6 @@ a.result-static:focus { background-color: #c3e0ff; } a.result-primitive:focus { background-color: #9aecff; } a.result-keyword:focus { background-color: #f99650; } -.content .item-info::before { color: #ccc; } - .content span.enum, .content a.enum, .block a.current.enum { color: #508157; } .content span.struct, .content a.struct, .block a.current.struct { color: #ad448e; } .content span.type, .content a.type, .block a.current.type { color: #ba5d00; }