diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2025-02-15 20:15:00 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-02-15 20:15:00 +0100 |
| commit | 29e2caf7c322c4edd7f45dc81006f50bb37f05e9 (patch) | |
| tree | 31ece7677eff41e1e1aafd4f2cd350f5c3219541 /src/librustdoc | |
| parent | df7002fac041871c3e76f56a4e80e0fead7ae2f6 (diff) | |
| parent | 02f1f346c2c83a930f2f4541b5181225491b875e (diff) | |
| download | rust-29e2caf7c322c4edd7f45dc81006f50bb37f05e9.tar.gz rust-29e2caf7c322c4edd7f45dc81006f50bb37f05e9.zip | |
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 https://github.com/rust-lang/rust/commit/2ea95f867012e91fa742e60b7b6424abf86c05cf
Diffstat (limited to 'src/librustdoc')
| -rw-r--r-- | src/librustdoc/html/static/js/main.js | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/librustdoc/html/static/js/main.js b/src/librustdoc/html/static/js/main.js index a348c6c5678..e46cc1897e9 100644 --- a/src/librustdoc/html/static/js/main.js +++ b/src/librustdoc/html/static/js/main.js @@ -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); |
