fix(rustdoc): Fixed Copy Item Path in rust doc

This commit is contained in:
Tapan Prakash 2025-02-15 15:34:27 +05:30
parent 54a0f387ea
commit 02f1f346c2

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);