diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2020-07-16 18:34:49 +0200 | 
|---|---|---|
| committer | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2020-07-16 18:34:49 +0200 | 
| commit | 52c65e05f53e7a49345bc3041e5656735fdc4f9c (patch) | |
| tree | 300dde152ec8396b3c234d7d4f056e47310f3d95 | |
| parent | 382d5bb715859423a086c6b26e651c18adf0dcb9 (diff) | |
| download | rust-52c65e05f53e7a49345bc3041e5656735fdc4f9c.tar.gz rust-52c65e05f53e7a49345bc3041e5656735fdc4f9c.zip  | |
Remove elements iterator clone and only keep first element instead
| -rw-r--r-- | src/librustdoc/html/static/source-script.js | 6 | 
1 files changed, 3 insertions, 3 deletions
diff --git a/src/librustdoc/html/static/source-script.js b/src/librustdoc/html/static/source-script.js index 5c39e760f44..6805f2a266f 100644 --- a/src/librustdoc/html/static/source-script.js +++ b/src/librustdoc/html/static/source-script.js @@ -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(); } }  | 
