diff options
| author | Guillaume Gomez <guillaume.gomez@huawei.com> | 2023-09-18 15:22:40 +0200 |
|---|---|---|
| committer | Guillaume Gomez <guillaume.gomez@huawei.com> | 2023-09-18 15:52:21 +0200 |
| commit | 354397f04dff7769c70dbaff9505056523c0bd22 (patch) | |
| tree | 61fde0b1e7b7fe99fe4e8c80a8057e6205c0ed9c /src | |
| parent | 078eb1120a3f576598b976d9470701363f48fccc (diff) | |
Move mobile topbar title creation entirely into JS
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustdoc/html/static/js/main.js | 8 | ||||
| -rw-r--r-- | src/librustdoc/html/templates/page.html | 3 |
2 files changed, 6 insertions, 5 deletions
diff --git a/src/librustdoc/html/static/js/main.js b/src/librustdoc/html/static/js/main.js index 097aa0b940d..eb256455b08 100644 --- a/src/librustdoc/html/static/js/main.js +++ b/src/librustdoc/html/static/js/main.js @@ -49,10 +49,12 @@ window.currentCrate = getVar("current-crate"); function setMobileTopbar() { // FIXME: It would be nicer to generate this text content directly in HTML, // but with the current code it's hard to get the right information in the right place. - const mobileLocationTitle = document.querySelector(".mobile-topbar h2"); + const mobileTopbar = document.querySelector(".mobile-topbar"); const locationTitle = document.querySelector(".sidebar h2.location"); - if (mobileLocationTitle && locationTitle) { - mobileLocationTitle.innerHTML = locationTitle.innerHTML; + if (mobileTopbar && locationTitle) { + const mobileTitle = document.createElement("h2"); + mobileTitle.innerHTML = locationTitle.innerHTML; + mobileTopbar.appendChild(mobileTitle); } } diff --git a/src/librustdoc/html/templates/page.html b/src/librustdoc/html/templates/page.html index b4b9c319165..579c782be09 100644 --- a/src/librustdoc/html/templates/page.html +++ b/src/librustdoc/html/templates/page.html @@ -84,8 +84,7 @@ <img class="rust-logo" src="{{static_root_path|safe}}{{files.rust_logo_svg}}" alt="logo"> {# #} {% endif %} </a> {# #} - <h2></h2> {# #} - </nav> {# #} + </nav> {% endif %} <nav class="sidebar"> {# #} {% if page.css_class != "src" %} |
