Skip to content

Commit 354397f

Browse files
Move mobile topbar title creation entirely into JS
1 parent 078eb11 commit 354397f

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

Diff for: src/librustdoc/html/static/js/main.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,12 @@ window.currentCrate = getVar("current-crate");
4949
function setMobileTopbar() {
5050
// FIXME: It would be nicer to generate this text content directly in HTML,
5151
// but with the current code it's hard to get the right information in the right place.
52-
const mobileLocationTitle = document.querySelector(".mobile-topbar h2");
52+
const mobileTopbar = document.querySelector(".mobile-topbar");
5353
const locationTitle = document.querySelector(".sidebar h2.location");
54-
if (mobileLocationTitle && locationTitle) {
55-
mobileLocationTitle.innerHTML = locationTitle.innerHTML;
54+
if (mobileTopbar && locationTitle) {
55+
const mobileTitle = document.createElement("h2");
56+
mobileTitle.innerHTML = locationTitle.innerHTML;
57+
mobileTopbar.appendChild(mobileTitle);
5658
}
5759
}
5860

Diff for: src/librustdoc/html/templates/page.html

+1-2
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,7 @@
8484
<img class="rust-logo" src="{{static_root_path|safe}}{{files.rust_logo_svg}}" alt="logo"> {# #}
8585
{% endif %}
8686
</a> {# #}
87-
<h2></h2> {# #}
88-
</nav> {# #}
87+
</nav>
8988
{% endif %}
9089
<nav class="sidebar"> {# #}
9190
{% if page.css_class != "src" %}

0 commit comments

Comments
 (0)