Skip to content

Commit

Permalink
Remove elements iterator clone and only keep first element instead
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Jul 16, 2020
1 parent 382d5bb commit 52c65e0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/librustdoc/html/static/source-script.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,8 @@ function createSourceSidebar() {

main.insertBefore(sidebar, main.firstChild);
// Focus on the current file in the source files sidebar.
var selected_elems = Array.prototype.slice.call(sidebar.getElementsByClassName("selected"));
if (selected_elems.length > 0) {
selected_elems[0].focus();
var selected_elem = sidebar.getElementsByClassName("selected")[0];
if (typeof selected_elem !== "undefined") {
selected_elem.focus();
}
}

0 comments on commit 52c65e0

Please sign in to comment.