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`.
This commit is contained in:
Michael Howell 2022-09-17 09:38:57 -07:00
parent c07a6a9c0c
commit ac732b62dd
2 changed files with 11 additions and 7 deletions

View File

@ -163,9 +163,6 @@ h1.fqn {
padding-bottom: 6px; padding-bottom: 6px;
margin-bottom: 15px; margin-bottom: 15px;
} }
#toggle-all-docs {
text-decoration: none;
}
/* The only headings that get underlines are: /* The only headings that get underlines are:
Markdown-generated headings within the top-doc Markdown-generated headings within the top-doc
Rustdoc-generated h2 section headings (e.g. "Implementations", "Required Methods", etc) 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; font-family: "Fira Sans", Arial, NanumBarunGothic, sans-serif;
} }
a#toggle-all-docs, #toggle-all-docs,
a.anchor, a.anchor,
.small-section-header a, .small-section-header a,
#source-sidebar a, #source-sidebar a,
@ -303,6 +300,13 @@ button {
padding: 1px 6px; padding: 1px 6px;
} }
button#toggle-all-docs {
padding: 0;
background: none;
border: none;
cursor: pointer;
}
/* end tweaks for normalize.css 8 */ /* end tweaks for normalize.css 8 */
.rustdoc { .rustdoc {

View File

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