@@ -512,21 +512,6 @@ function getSearchElement() {
512
512
var OUTPUT_DATA = 1 ;
513
513
var params = getQueryStringParams ( ) ;
514
514
515
- // Set the crate filter from saved storage, if the current page has the saved crate filter.
516
- //
517
- // If not, ignore the crate filter -- we want to support filtering for crates on sites like
518
- // doc.rust-lang.org where the crates may differ from page to page while on the same domain.
519
- var savedCrate = getCurrentValue ( "rustdoc-saved-filter-crate" ) ;
520
- if ( savedCrate !== null ) {
521
- onEachLazy ( document . getElementById ( "crate-search" ) . getElementsByTagName ( "option" ) ,
522
- function ( e ) {
523
- if ( e . value === savedCrate ) {
524
- document . getElementById ( "crate-search" ) . value = e . value ;
525
- return true ;
526
- }
527
- } ) ;
528
- }
529
-
530
515
// Populate search bar with query string search term when provided,
531
516
// but only if the input bar is empty. This avoid the obnoxious issue
532
517
// where you start trying to do a search, and the index loads, and
@@ -2620,11 +2605,21 @@ function getSearchElement() {
2620
2605
}
2621
2606
return 0 ;
2622
2607
} ) ;
2608
+ var savedCrate = getCurrentValue ( "rustdoc-saved-filter-crate" ) ;
2623
2609
for ( var i = 0 ; i < crates_text . length ; ++ i ) {
2624
2610
var option = document . createElement ( "option" ) ;
2625
2611
option . value = crates_text [ i ] ;
2626
2612
option . innerText = crates_text [ i ] ;
2627
2613
elem . appendChild ( option ) ;
2614
+ // Set the crate filter from saved storage, if the current page has the saved crate
2615
+ // filter.
2616
+ //
2617
+ // If not, ignore the crate filter -- we want to support filtering for crates on sites
2618
+ // like doc.rust-lang.org where the crates may differ from page to page while on the
2619
+ // same domain.
2620
+ if ( crates_text [ i ] === savedCrate ) {
2621
+ elem . value = savedCrate ;
2622
+ }
2628
2623
}
2629
2624
}
2630
2625
0 commit comments