1
Fork 0

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 https://github.com/rust-lang/rust/issues/137048
Issue caused by previous changes for removing `@ts-expect-error` by this change 2ea95f8670
This commit is contained in:
Matthias Krüger 2025-02-15 20:15:00 +01:00 committed by GitHub
commit 29e2caf7c3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -2039,7 +2039,10 @@ function preLoadCss(cssUrl) {
// Most page titles are '<Item> in <path::to::module> - Rust', except
// modules (which don't have the first part) and keywords/primitives
// (which don't have a module path)
const [item, module] = document.title.split(" in ");
const titleElement = document.querySelector("title");
const title = titleElement && titleElement.textContent ?
titleElement.textContent.replace(" - Rust", "") : "";
const [item, module] = title.split(" in ");
const path = [item];
if (module !== undefined) {
path.unshift(module);