Skip to content

Commit 891c6ee

Browse files
committed
Auto merge of #117864 - notriddle:notriddle/rustdoc-root, r=GuillaumeGomez
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
2 parents c225c45 + 8b1bcc8 commit 891c6ee

File tree

1 file changed

+2
-2
lines changed
  • src/librustdoc/html/static/js

1 file changed

+2
-2
lines changed

src/librustdoc/html/static/js/main.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ function setMobileTopbar() {
5454
if (mobileTopbar) {
5555
const mobileTitle = document.createElement("h2");
5656
mobileTitle.className = "location";
57-
if (hasClass(document.body, "crate")) {
57+
if (hasClass(document.querySelector(".rustdoc"), "crate")) {
5858
mobileTitle.innerText = `Crate ${window.currentCrate}`;
5959
} else if (locationTitle) {
6060
mobileTitle.innerHTML = locationTitle.innerHTML;
@@ -485,7 +485,7 @@ function preLoadCss(cssUrl) {
485485
return;
486486
}
487487

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

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

0 commit comments

Comments
 (0)