Skip to content

Commit 29e2caf

Browse files
authored
Rollup merge of #137068 - tapanprakasht:fix-copy-item-path, r=aDotInTheVoid
fix(rustdoc): Fixed `Copy Item Path` in rust doc This PR aims to address the issue reported by #137048 Issue caused by previous changes for removing `@ts-expect-error` by this change 2ea95f8
2 parents df7002f + 02f1f34 commit 29e2caf

File tree

1 file changed

+4
-1
lines changed
  • src/librustdoc/html/static/js

1 file changed

+4
-1
lines changed

Diff for: src/librustdoc/html/static/js/main.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -2039,7 +2039,10 @@ function preLoadCss(cssUrl) {
20392039
// Most page titles are '<Item> in <path::to::module> - Rust', except
20402040
// modules (which don't have the first part) and keywords/primitives
20412041
// (which don't have a module path)
2042-
const [item, module] = document.title.split(" in ");
2042+
const titleElement = document.querySelector("title");
2043+
const title = titleElement && titleElement.textContent ?
2044+
titleElement.textContent.replace(" - Rust", "") : "";
2045+
const [item, module] = title.split(" in ");
20432046
const path = [item];
20442047
if (module !== undefined) {
20452048
path.unshift(module);

0 commit comments

Comments
 (0)