Skip to content

Commit 9d69ee0

Browse files
committed
rustdoc: lift constant string manipulation out of loop
1 parent 994dd69 commit 9d69ee0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/librustdoc/html/static/js/source-script.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,12 @@ function createDirEntry(elem, parent, fullPath, hasFoundFile) {
5252
const files = document.createElement("div");
5353
files.className = "files";
5454
if (elem[FILES_OFFSET]) {
55+
const w = window.location.href.split("#")[0];
5556
for (const file_text of elem[FILES_OFFSET]) {
5657
const file = document.createElement("a");
5758
file.innerText = file_text;
5859
file.href = rootPath + "src/" + fullPath + file_text + ".html";
5960
file.addEventListener("click", closeSidebarIfMobile);
60-
const w = window.location.href.split("#")[0];
6161
if (!hasFoundFile && w === file.href) {
6262
file.className = "selected";
6363
dirEntry.open = true;

0 commit comments

Comments
 (0)