diff --git a/src/librustdoc/html/render/print_item.rs b/src/librustdoc/html/render/print_item.rs index f1d79ab097b9f..c03617a14b911 100644 --- a/src/librustdoc/html/render/print_item.rs +++ b/src/librustdoc/html/render/print_item.rs @@ -140,7 +140,7 @@ fn toggle_open(w: &mut Buffer, text: &str) { write!( w, "
\ - \ + \ Show {}\ ", text diff --git a/src/librustdoc/html/static/rustdoc.css b/src/librustdoc/html/static/rustdoc.css index a024fa49b0e8b..9d1b34e076ed3 100644 --- a/src/librustdoc/html/static/rustdoc.css +++ b/src/librustdoc/html/static/rustdoc.css @@ -1355,6 +1355,64 @@ h4 > .notable-traits { border-top: 1px solid; } +/* The hide-me class is used on summary tags that contain a span with + placeholder text shown only when the toggle is closed. For instance, + "Expand description" or "Show methods". */ +details.rustdoc-toggle > summary.hide-me { + cursor: pointer; +} + +details.rustdoc-toggle > summary::marker { + display: none; +} + +details.rustdoc-toggle > summary::-webkit-details-marker { + display: none; +} + +details.rustdoc-toggle > summary.hide-me > span { + margin-left: 9px; +} + +details.rustdoc-toggle > summary::before { + content: "[+]"; + font-weight: 300; + font-size: 0.8em; + letter-spacing: 1px; + cursor: pointer; +} + +details.rustdoc-toggle > summary.hide-me::before { + position: relative; +} + +details.rustdoc-toggle > summary:not(.hide-me)::before { + position: absolute; + left: -23px; +} + +/* When a "hide-me" summary is open and the "Expand description" or "Show + methods" text is hidden, we want the [-] toggle that remains to not + affect the layout of the items to its right. To do that, we use + absolute positioning. Note that we also set position: relative + on the parent
to make this work properly. */ +details.rustdoc-toggle[open] > summary.hide-me { + position: absolute; +} + +details.rustdoc-toggle[open] { + position: relative; +} + +details.rustdoc-toggle[open] > summary.hide-me > span { + display: none; +} + +details.rustdoc-toggle[open] > summary::before { + content: "[−]"; + display: inline; +} + /* Media Queries */ @media (min-width: 701px) { @@ -1573,7 +1631,7 @@ h4 > .notable-traits { left: -10px; } - .item-list > details.rustdoc-toggle > summary:not(.hideme)::before { + details.rustdoc-toggle > summary:not(.hide-me)::before { left: -10px; } @@ -1770,57 +1828,3 @@ div.name.expand::before { left: -15px; top: 2px; } - -/* The hideme class is used on summary tags that contain a span with - placeholder text shown only when the toggle is closed. For instance, - "Expand description" or "Show methods". */ -details.rustdoc-toggle > summary.hideme { - cursor: pointer; -} - -details.rustdoc-toggle > summary::-webkit-details-marker { - display: none; -} - -details.rustdoc-toggle > summary.hideme > span { - margin-left: 9px; -} - -details.rustdoc-toggle > summary::before { - content: "[+]"; - font-weight: 300; - font-size: 0.8em; - letter-spacing: 1px; - cursor: pointer; -} - -details.rustdoc-toggle > summary.hideme::before { - position: relative; -} - -details.rustdoc-toggle > summary:not(.hideme)::before { - position: absolute; - left: -23px; -} - -/* When a "hideme" summary is open and the "Expand description" or "Show - methods" text is hidden, we want the [-] toggle that remains to not - affect the layout of the items to its right. To do that, we use - absolute positioning. Note that we also set position: relative - on the parent
to make this work properly. */ -details.rustdoc-toggle[open] > summary.hideme { - position: absolute; -} - -details.rustdoc-toggle[open] { - position: relative; -} - -details.rustdoc-toggle[open] > summary.hideme > span { - display: none; -} - -details.rustdoc-toggle[open] > summary::before { - content: "[−]"; - display: inline; -} diff --git a/src/librustdoc/html/static/themes/ayu.css b/src/librustdoc/html/static/themes/ayu.css index 72396ec6b76bd..850771bf088b8 100644 --- a/src/librustdoc/html/static/themes/ayu.css +++ b/src/librustdoc/html/static/themes/ayu.css @@ -225,7 +225,7 @@ a { } .collapse-toggle, -details.rustdoc-toggle > summary.hideme > span, +details.rustdoc-toggle > summary.hide-me > span, details.rustdoc-toggle > summary::before { color: #999; } diff --git a/src/librustdoc/html/static/themes/dark.css b/src/librustdoc/html/static/themes/dark.css index b2003b5274120..0540680c07fcc 100644 --- a/src/librustdoc/html/static/themes/dark.css +++ b/src/librustdoc/html/static/themes/dark.css @@ -187,7 +187,7 @@ a.test-arrow { } .collapse-toggle, -details.rustdoc-toggle > summary.hideme > span, +details.rustdoc-toggle > summary.hide-me > span, details.rustdoc-toggle > summary::before { color: #999; } diff --git a/src/librustdoc/html/static/themes/light.css b/src/librustdoc/html/static/themes/light.css index 04187773b64db..d79bfb1451e60 100644 --- a/src/librustdoc/html/static/themes/light.css +++ b/src/librustdoc/html/static/themes/light.css @@ -185,7 +185,7 @@ a.test-arrow { } .collapse-toggle, -details.rustdoc-toggle > summary.hideme > span, +details.rustdoc-toggle > summary.hide-me > span, details.rustdoc-toggle > summary::before { color: #999; }