File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change 129
129
domSearch . addEventListener ( 'input' , onSearchChange , false ) ;
130
130
window . addEventListener ( 'keydown' , onWindowKeyDown , false ) ;
131
131
onHashChange ( null ) ;
132
+ if ( domSearch . value ) {
133
+ // user started typing a search query while the page was loading
134
+ curSearchIndex = - 1 ;
135
+ startAsyncSearch ( ) ;
136
+ }
132
137
} ) ;
133
138
} ) ;
134
139
643
648
}
644
649
645
650
function onHashChange ( state ) {
651
+ // Use a non-null state value to prevent the window scrolling if the user goes back to this history entry.
646
652
history . replaceState ( { } , "" ) ;
647
653
navigate ( location . hash ) ;
648
654
if ( state == null ) window . scrollTo ( { top : 0 } ) ;
649
655
}
650
656
651
657
function onPopState ( ev ) {
652
658
onHashChange ( ev . state ) ;
659
+ syncDomSearch ( ) ;
653
660
}
654
661
655
662
function navigate ( location_hash ) {
656
663
updateCurNav ( location_hash ) ;
657
- if ( domSearch . value !== curNavSearch ) {
658
- domSearch . value = curNavSearch ;
659
- }
660
664
render ( ) ;
661
665
if ( imFeelingLucky ) {
662
666
imFeelingLucky = false ;
663
667
activateSelectedResult ( ) ;
664
668
}
665
669
}
666
670
671
+ function syncDomSearch ( ) {
672
+ if ( domSearch . value !== curNavSearch ) {
673
+ domSearch . value = curNavSearch ;
674
+ }
675
+ }
676
+
667
677
function activateSelectedResult ( ) {
668
678
if ( domSectSearchResults . classList . contains ( "hidden" ) ) {
669
679
return ;
You can’t perform that action at this time.
0 commit comments