Navigation Menu

Skip to content

Commit

Permalink
Use an id instead of a function
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Aug 29, 2020
1 parent 4b8ebbc commit 3a4ef0f
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/librustdoc/html/static/main.js
Expand Up @@ -92,6 +92,7 @@ function defocusSearchBar() {
var disableShortcuts = getCurrentValue("rustdoc-disable-shortcuts") === "true";
var search_input = getSearchInput();
var searchTimeout = null;
var toggleAllDocsId = "toggle-all-docs";

// On the search screen, so you remain on the last tab you opened.
//
Expand Down Expand Up @@ -2113,12 +2114,8 @@ function defocusSearchBar() {
}
}

function getToggleAllDocsElement() {
return document.getElementById("toggle-all-docs");
}

function toggleAllDocs(pageId, fromAutoCollapse) {
var innerToggle = getToggleAllDocsElement();
var innerToggle = document.getElementById(toggleAllDocsId);
if (!innerToggle) {
return;
}
Expand Down Expand Up @@ -2360,7 +2357,7 @@ function defocusSearchBar() {
}

(function() {
var toggles = document.getElementById("toggle-all-docs");
var toggles = document.getElementById(toggleAllDocsId);
if (toggles) {
toggles.onclick = toggleAllDocs;
}
Expand Down

0 comments on commit 3a4ef0f

Please sign in to comment.