We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 382d5bb commit 52c65e0Copy full SHA for 52c65e0
src/librustdoc/html/static/source-script.js
@@ -141,8 +141,8 @@ function createSourceSidebar() {
141
142
main.insertBefore(sidebar, main.firstChild);
143
// Focus on the current file in the source files sidebar.
144
- var selected_elems = Array.prototype.slice.call(sidebar.getElementsByClassName("selected"));
145
- if (selected_elems.length > 0) {
146
- selected_elems[0].focus();
+ var selected_elem = sidebar.getElementsByClassName("selected")[0];
+ if (typeof selected_elem !== "undefined") {
+ selected_elem.focus();
147
}
148
0 commit comments