about summary refs log tree commit diff
path: root/src/librustdoc/html/static/js/source-script.js
diff options
context:
space:
mode:
authorYuki Okushi <jtitor@2k36.org>2023-04-22 10:33:59 +0900
committerGitHub <noreply@github.com>2023-04-22 10:33:59 +0900
commitc8a32391c705055f6db2dfd0338562bcac367e44 (patch)
tree222ba5cb8dad3e0b1362f90ac5d0d22c457c807b /src/librustdoc/html/static/js/source-script.js
parent617ecd2a7a9906eccd93c04d27636f0934988af7 (diff)
parent0cd387415558729c72962bf8f47d229f0b93ce50 (diff)
downloadrust-c8a32391c705055f6db2dfd0338562bcac367e44.tar.gz
rust-c8a32391c705055f6db2dfd0338562bcac367e44.zip
Rollup merge of #110659 - notriddle:notriddle/js-cleanup-20230421, r=GuillaumeGomez
rustdoc: clean up JS

* use `Set` for ignored crates in cross-crate trait impl JS, instead of `indexOf` string manipulation
* lift constant `window.location.split` code out of a loop in source code sidebar builder
* remove redundant history manipulation from search page exit
Diffstat (limited to 'src/librustdoc/html/static/js/source-script.js')
-rw-r--r--src/librustdoc/html/static/js/source-script.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/librustdoc/html/static/js/source-script.js b/src/librustdoc/html/static/js/source-script.js
index 9aa75517330..d999f3b36fd 100644
--- a/src/librustdoc/html/static/js/source-script.js
+++ b/src/librustdoc/html/static/js/source-script.js
@@ -52,12 +52,12 @@ function createDirEntry(elem, parent, fullPath, hasFoundFile) {
     const files = document.createElement("div");
     files.className = "files";
     if (elem[FILES_OFFSET]) {
+        const w = window.location.href.split("#")[0];
         for (const file_text of elem[FILES_OFFSET]) {
             const file = document.createElement("a");
             file.innerText = file_text;
             file.href = rootPath + "src/" + fullPath + file_text + ".html";
             file.addEventListener("click", closeSidebarIfMobile);
-            const w = window.location.href.split("#")[0];
             if (!hasFoundFile && w === file.href) {
                 file.className = "selected";
                 dirEntry.open = true;