Skip to content

Commit

Permalink
Auto merge of #117864 - notriddle:notriddle/rustdoc-root, r=Guillaume…
Browse files Browse the repository at this point in the history
…Gomez

rustdoc: use `.rustdoc` class instead of `body`

This didn't show up in our local tests, because the problem is actually caused by docs.rs rewritten HTML (which relocates the classes that this code looked for from the body tag to a child div).

Fixes #117290

r? `@GuillaumeGomez`

Both problems are regressions introduced by #115948
  • Loading branch information
bors committed Nov 13, 2023
2 parents c225c45 + 8b1bcc8 commit 891c6ee
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/librustdoc/html/static/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ function setMobileTopbar() {
if (mobileTopbar) {
const mobileTitle = document.createElement("h2");
mobileTitle.className = "location";
if (hasClass(document.body, "crate")) {
if (hasClass(document.querySelector(".rustdoc"), "crate")) {
mobileTitle.innerText = `Crate ${window.currentCrate}`;
} else if (locationTitle) {
mobileTitle.innerHTML = locationTitle.innerHTML;
Expand Down Expand Up @@ -485,7 +485,7 @@ function preLoadCss(cssUrl) {
return;
}

const modpath = hasClass(document.body, "mod") ? "../" : "";
const modpath = hasClass(document.querySelector(".rustdoc"), "mod") ? "../" : "";

const h3 = document.createElement("h3");
h3.innerHTML = `<a href="${modpath}index.html#${id}">${longty}</a>`;
Expand Down

0 comments on commit 891c6ee

Please sign in to comment.