about summary refs log tree commit diff
path: root/src/librustdoc/html/static/js/main.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/librustdoc/html/static/js/main.js')
-rw-r--r--src/librustdoc/html/static/js/main.js7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/librustdoc/html/static/js/main.js b/src/librustdoc/html/static/js/main.js
index 5e852af2196..25e9da57a05 100644
--- a/src/librustdoc/html/static/js/main.js
+++ b/src/librustdoc/html/static/js/main.js
@@ -51,12 +51,13 @@ function setMobileTopbar() {
     // but with the current code it's hard to get the right information in the right place.
     const mobileTopbar = document.querySelector(".mobile-topbar");
     const locationTitle = document.querySelector(".sidebar h2.location");
-    if (mobileLocationTitle) {
+    if (mobileTopbar) {
         const mobileTitle = document.createElement("h2");
+        mobileTitle.className = "location";
         if (hasClass(document.body, "crate")) {
-            mobileLocationTitle.innerText = `Crate ${window.currentCrate}`;
+            mobileTitle.innerText = `Crate ${window.currentCrate}`;
         } else if (locationTitle) {
-            mobileLocationTitle.innerHTML = locationTitle.innerHTML;
+            mobileTitle.innerHTML = locationTitle.innerHTML;
         }
         mobileTopbar.appendChild(mobileTitle);
     }