From 354397f04dff7769c70dbaff9505056523c0bd22 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Mon, 18 Sep 2023 15:22:40 +0200 Subject: [PATCH] Move mobile topbar title creation entirely into JS --- src/librustdoc/html/static/js/main.js | 8 +++++--- 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 @@ {# #} {% endif %} {# #} -

{# #} - {# #} + {% endif %}