Skip to content

Commit ac732b6

Browse files
committed
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`.
1 parent c07a6a9 commit ac732b6

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

src/librustdoc/html/static/css/rustdoc.css

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,9 +163,6 @@ h1.fqn {
163163
padding-bottom: 6px;
164164
margin-bottom: 15px;
165165
}
166-
#toggle-all-docs {
167-
text-decoration: none;
168-
}
169166
/* The only headings that get underlines are:
170167
Markdown-generated headings within the top-doc
171168
Rustdoc-generated h2 section headings (e.g. "Implementations", "Required Methods", etc)
@@ -209,7 +206,7 @@ ul.all-items {
209206
font-family: "Fira Sans", Arial, NanumBarunGothic, sans-serif;
210207
}
211208

212-
a#toggle-all-docs,
209+
#toggle-all-docs,
213210
a.anchor,
214211
.small-section-header a,
215212
#source-sidebar a,
@@ -303,6 +300,13 @@ button {
303300
padding: 1px 6px;
304301
}
305302

303+
button#toggle-all-docs {
304+
padding: 0;
305+
background: none;
306+
border: none;
307+
cursor: pointer;
308+
}
309+
306310
/* end tweaks for normalize.css 8 */
307311

308312
.rustdoc {

src/librustdoc/html/templates/print_item.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ <h1 class="fqn"> {#- -#}
2121
<a class="srclink" href="{{href|safe}}">source</a> · {# -#}
2222
{%- else -%}
2323
{%- endmatch -%}
24-
<a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs"> {#- -#}
25-
[<span class="inner">&#x2212;</span>] {#- -#}
26-
</a> {#- -#}
24+
<button id="toggle-all-docs" title="collapse all docs"> {#- -#}
25+
[<span>&#x2212;</span>] {#- -#}
26+
</button> {#- -#}
2727
</span> {#- -#}
2828
</div> {#- -#}

0 commit comments

Comments
 (0)