@@ -4819,58 +4819,6 @@ function registerSearchEvents() {
48194819 searchState . inputElement ( ) . addEventListener ( "blur" , ( ) => {
48204820 searchState . inputElement ( ) . placeholder = searchState . inputElement ( ) . origPlaceholder ;
48214821 } ) ;
4822-
4823- // Push and pop states are used to add search results to the browser
4824- // history.
4825- if ( browserSupportsHistoryApi ( ) ) {
4826- // Store the previous <title> so we can revert back to it later.
4827- const previousTitle = document . title ;
4828-
4829- window . addEventListener ( "popstate" , e => {
4830- const params = searchState . getQueryStringParams ( ) ;
4831- // Revert to the previous title manually since the History
4832- // API ignores the title parameter.
4833- document . title = previousTitle ;
4834- // When browsing forward to search results the previous
4835- // search will be repeated, so the currentResults are
4836- // cleared to ensure the search is successful.
4837- currentResults = null ;
4838- // Synchronize search bar with query string state and
4839- // perform the search. This will empty the bar if there's
4840- // nothing there, which lets you really go back to a
4841- // previous state with nothing in the bar.
4842- if ( params . search !== undefined ) {
4843- searchState . inputElement ( ) . value = params . search ;
4844- // Some browsers fire "onpopstate" for every page load
4845- // (Chrome), while others fire the event only when actually
4846- // popping a state (Firefox), which is why search() is
4847- // called both here and at the end of the startSearch()
4848- // function.
4849- e . preventDefault ( ) ;
4850- search ( ) ;
4851- } else {
4852- // When browsing back from search results the main page
4853- // visibility must be reset.
4854- searchState . hideResults ( ) ;
4855- }
4856- } ) ;
4857- }
4858-
4859- // This is required in firefox to avoid this problem: Navigating to a search result
4860- // with the keyboard, hitting enter, and then hitting back would take you back to
4861- // the doc page, rather than the search that should overlay it.
4862- // This was an interaction between the back-forward cache and our handlers
4863- // that try to sync state between the URL and the search input. To work around it,
4864- // do a small amount of re-init on page show.
4865- window . onpageshow = ( ) => {
4866- const qSearch = searchState . getQueryStringParams ( ) . search ;
4867- if ( qSearch !== undefined ) {
4868- if ( searchState . inputElement ( ) . value === "" ) {
4869- searchState . inputElement ( ) . value = qSearch ;
4870- }
4871- search ( ) ;
4872- }
4873- } ;
48744822}
48754823
48764824function updateCrate ( ev ) {
0 commit comments