@@ -521,21 +521,6 @@ function getSearchElement() {
521
521
var OUTPUT_DATA = 1 ;
522
522
var params = getQueryStringParams ( ) ;
523
523
524
- // Set the crate filter from saved storage, if the current page has the saved crate filter.
525
- //
526
- // If not, ignore the crate filter -- we want to support filtering for crates on sites like
527
- // doc.rust-lang.org where the crates may differ from page to page while on the same domain.
528
- var savedCrate = getCurrentValue ( "rustdoc-saved-filter-crate" ) ;
529
- if ( savedCrate !== null ) {
530
- onEachLazy ( document . getElementById ( "crate-search" ) . getElementsByTagName ( "option" ) ,
531
- function ( e ) {
532
- if ( e . value === savedCrate ) {
533
- document . getElementById ( "crate-search" ) . value = e . value ;
534
- return true ;
535
- }
536
- } ) ;
537
- }
538
-
539
524
// Populate search bar with query string search term when provided,
540
525
// but only if the input bar is empty. This avoid the obnoxious issue
541
526
// where you start trying to do a search, and the index loads, and
@@ -2629,11 +2614,21 @@ function getSearchElement() {
2629
2614
}
2630
2615
return 0 ;
2631
2616
} ) ;
2617
+ var savedCrate = getCurrentValue ( "rustdoc-saved-filter-crate" ) ;
2632
2618
for ( var i = 0 ; i < crates_text . length ; ++ i ) {
2633
2619
var option = document . createElement ( "option" ) ;
2634
2620
option . value = crates_text [ i ] ;
2635
2621
option . innerText = crates_text [ i ] ;
2636
2622
elem . appendChild ( option ) ;
2623
+ // Set the crate filter from saved storage, if the current page has the saved crate
2624
+ // filter.
2625
+ //
2626
+ // If not, ignore the crate filter -- we want to support filtering for crates on sites
2627
+ // like doc.rust-lang.org where the crates may differ from page to page while on the
2628
+ // same domain.
2629
+ if ( crates_text [ i ] === savedCrate ) {
2630
+ elem . value = savedCrate ;
2631
+ }
2637
2632
}
2638
2633
2639
2634
if ( search_input ) {
0 commit comments