From 0fa4762a807a8e637aeaa805bc705c52a1c70d13 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Sun, 17 May 2020 14:06:21 +0200 Subject: [PATCH] Move focusSearchBar and defocusSearchBar functions to the top of the file with other functions --- src/librustdoc/html/static/main.js | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js index 9869c50fbb0c..94d74bf793e7 100644 --- a/src/librustdoc/html/static/main.js +++ b/src/librustdoc/html/static/main.js @@ -47,6 +47,17 @@ function getSearchElement() { return document.getElementById("search"); } +// Sets the focus on the search bar at the top of the page +function focusSearchBar() { + getSearchInput().focus(); +} + +// Removes the focus from the search bar +function defocusSearchBar() { + getSearchInput().blur(); +} + + (function() { "use strict"; @@ -2778,16 +2789,6 @@ function getSearchElement() { buildHelperPopup(); }()); -// Sets the focus on the search bar at the top of the page -function focusSearchBar() { - getSearchInput().focus(); -} - -// Removes the focus from the search bar -function defocusSearchBar() { - getSearchInput().blur(); -} - // This is required in firefox. Explanations: when going back in the history, firefox doesn't re-run // the JS, therefore preventing rustdoc from setting a few things required to be able to reload the // previous search results (if you navigated to a search result with the keyboard, pressed enter on