Skip to content

Commit 0fa4762

Browse files
Move focusSearchBar and defocusSearchBar functions to the top of the file with other functions
1 parent 9eedd13 commit 0fa4762

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

src/librustdoc/html/static/main.js

+11-10
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,17 @@ function getSearchElement() {
4747
return document.getElementById("search");
4848
}
4949

50+
// Sets the focus on the search bar at the top of the page
51+
function focusSearchBar() {
52+
getSearchInput().focus();
53+
}
54+
55+
// Removes the focus from the search bar
56+
function defocusSearchBar() {
57+
getSearchInput().blur();
58+
}
59+
60+
5061
(function() {
5162
"use strict";
5263

@@ -2778,16 +2789,6 @@ function getSearchElement() {
27782789
buildHelperPopup();
27792790
}());
27802791

2781-
// Sets the focus on the search bar at the top of the page
2782-
function focusSearchBar() {
2783-
getSearchInput().focus();
2784-
}
2785-
2786-
// Removes the focus from the search bar
2787-
function defocusSearchBar() {
2788-
getSearchInput().blur();
2789-
}
2790-
27912792
// This is required in firefox. Explanations: when going back in the history, firefox doesn't re-run
27922793
// the JS, therefore preventing rustdoc from setting a few things required to be able to reload the
27932794
// previous search results (if you navigated to a search result with the keyboard, pressed enter on

0 commit comments

Comments
 (0)