diff options
| author | bors <bors@rust-lang.org> | 2021-01-16 00:13:26 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-01-16 00:13:26 +0000 |
| commit | 6c869d34ae2d87d21db9892d4dc088639bcbe041 (patch) | |
| tree | 934fcc1bd4782a3810b643633412ab8649ea58fa /src/librustdoc/html/static/source-script.js | |
| parent | fcbd305ee93f49f19313b9bbeaa25ba8837030d9 (diff) | |
| parent | f8b1baac113ed85175453e6dad709dbd65836540 (diff) | |
| download | rust-6c869d34ae2d87d21db9892d4dc088639bcbe041.tar.gz rust-6c869d34ae2d87d21db9892d4dc088639bcbe041.zip | |
Auto merge of #81057 - GuillaumeGomez:rollup-yl2kqst, r=GuillaumeGomez
Rollup of 6 pull requests Successful merges: - #77693 (Add test for #59352) - #80515 (Improve JS performance by storing length before comparing to it in loops) - #81030 (Update mdbook) - #81033 (Remove useless `clean::Variant` struct) - #81049 (inline: Round word-size cost estimates up) - #81054 (Drop a few unneeded borrows) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'src/librustdoc/html/static/source-script.js')
| -rw-r--r-- | src/librustdoc/html/static/source-script.js | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/librustdoc/html/static/source-script.js b/src/librustdoc/html/static/source-script.js index 6805f2a266f..a9cc0ffdf79 100644 --- a/src/librustdoc/html/static/source-script.js +++ b/src/librustdoc/html/static/source-script.js @@ -8,7 +8,7 @@ function getCurrentFilePath() { var parts = window.location.pathname.split("/"); var rootPathParts = window.rootPath.split("/"); - for (var i = 0; i < rootPathParts.length; ++i) { + for (var i = 0, len = rootPathParts.length; i < len; ++i) { if (rootPathParts[i] === "..") { parts.pop(); } @@ -35,12 +35,14 @@ function createDirEntry(elem, parent, fullPath, currentFile, hasFoundFile) { }; name.innerText = elem["name"]; + var i, len; + var children = document.createElement("div"); children.className = "children"; var folders = document.createElement("div"); folders.className = "folders"; if (elem.dirs) { - for (var i = 0; i < elem.dirs.length; ++i) { + for (i = 0, len = elem.dirs.length; i < len; ++i) { if (createDirEntry(elem.dirs[i], folders, fullPath, currentFile, hasFoundFile) === true) { addClass(name, "expand"); @@ -53,7 +55,7 @@ function createDirEntry(elem, parent, fullPath, currentFile, hasFoundFile) { var files = document.createElement("div"); files.className = "files"; if (elem.files) { - for (i = 0; i < elem.files.length; ++i) { + for (i = 0, len = elem.files.length; i < len; ++i) { var file = document.createElement("a"); file.innerText = elem.files[i]; file.href = window.rootPath + "src/" + fullPath + elem.files[i] + ".html"; |
