@@ -92,6 +92,7 @@ function defocusSearchBar() {
9292 var disableShortcuts = getCurrentValue ( "rustdoc-disable-shortcuts" ) === "true" ;
9393 var search_input = getSearchInput ( ) ;
9494 var searchTimeout = null ;
95+ var toggleAllDocsId = "toggle-all-docs" ;
9596
9697 // On the search screen, so you remain on the last tab you opened.
9798 //
@@ -1397,8 +1398,8 @@ function defocusSearchBar() {
13971398 // "current" is used to know which tab we're looking into.
13981399 var current = 0 ;
13991400 onEachLazy ( document . getElementById ( "results" ) . childNodes , function ( e ) {
1400- onEachLazy ( e . getElementsByClassName ( "highlighted" ) , function ( e ) {
1401- actives [ current ] . push ( e ) ;
1401+ onEachLazy ( e . getElementsByClassName ( "highlighted" ) , function ( h_e ) {
1402+ actives [ current ] . push ( h_e ) ;
14021403 } ) ;
14031404 current += 1 ;
14041405 } ) ;
@@ -2121,7 +2122,7 @@ function defocusSearchBar() {
21212122 }
21222123
21232124 function toggleAllDocs ( pageId , fromAutoCollapse ) {
2124- var innerToggle = document . getElementById ( "toggle-all-docs" ) ;
2125+ var innerToggle = document . getElementById ( toggleAllDocsId ) ;
21252126 if ( ! innerToggle ) {
21262127 return ;
21272128 }
@@ -2314,11 +2315,6 @@ function defocusSearchBar() {
23142315 }
23152316 }
23162317
2317- var toggles = document . getElementById ( "toggle-all-docs" ) ;
2318- if ( toggles ) {
2319- toggles . onclick = toggleAllDocs ;
2320- }
2321-
23222318 function insertAfter ( newNode , referenceNode ) {
23232319 referenceNode . parentNode . insertBefore ( newNode , referenceNode . nextSibling ) ;
23242320 }
@@ -2368,6 +2364,11 @@ function defocusSearchBar() {
23682364 }
23692365
23702366 ( function ( ) {
2367+ var toggles = document . getElementById ( toggleAllDocsId ) ;
2368+ if ( toggles ) {
2369+ toggles . onclick = toggleAllDocs ;
2370+ }
2371+
23712372 var toggle = createSimpleToggle ( false ) ;
23722373 var hideMethodDocs = getCurrentValue ( "rustdoc-auto-hide-method-docs" ) === "true" ;
23732374 var hideImplementors = getCurrentValue ( "rustdoc-auto-collapse-implementors" ) !== "false" ;
0 commit comments