Rollup merge of #101944 - notriddle:notriddle/toggle-all-docs, r=jsha,GuillaumeGomez

rustdoc: clean up `#toggle-all-docs`

This change converts the element from an `<a>` link to a button. It's pretty much directly trading slightly more CSS for slightly less HTML, and it's also semantically correct (so you don't get a broken "bookmark" option when you right click on it).

While doing this, I also got rid of the unnecessary `class="inner"` attribute on the inner span. There was a style targeting `.collapse-toggle > .inner`, but no CSS ever targeted the `#toggle-all-docs > .inner`.

Preview: https://notriddle.com/notriddle-rustdoc-test/button-toggle-all-docs/index.html
This commit is contained in:
Michael Howell 2022-10-30 19:31:37 -07:00 committed by GitHub
commit 8d6ed3edec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 7 deletions

View File

@ -163,9 +163,6 @@ h1.fqn {
padding-bottom: 6px;
margin-bottom: 15px;
}
#toggle-all-docs {
text-decoration: none;
}
/* The only headings that get underlines are:
Markdown-generated headings within the top-doc
Rustdoc-generated h2 section headings (e.g. "Implementations", "Required Methods", etc)
@ -209,7 +206,7 @@ ul.all-items {
font-family: "Fira Sans", Arial, NanumBarunGothic, sans-serif;
}
a#toggle-all-docs,
#toggle-all-docs,
a.anchor,
.small-section-header a,
#source-sidebar a,
@ -299,6 +296,16 @@ button {
padding: 1px 6px;
}
button#toggle-all-docs {
padding: 0;
background: none;
border: none;
cursor: pointer;
/* iOS button gradient: https://stackoverflow.com/q/5438567 */
-webkit-appearance: none;
opacity: 1;
}
/* end tweaks for normalize.css 8 */
.rustdoc {

View File

@ -21,8 +21,8 @@
<a class="srclink" href="{{href|safe}}">source</a> · {# -#}
{%- else -%}
{%- endmatch -%}
<a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs"> {#- -#}
[<span class="inner">&#x2212;</span>] {#- -#}
</a> {#- -#}
<button id="toggle-all-docs" title="collapse all docs"> {#- -#}
[<span>&#x2212;</span>] {#- -#}
</button> {#- -#}
</span> {#- -#}
</div> {#- -#}