Skip to content

Commit 5b2e477

Browse files
committed
rustdoc: Make going back in browser history work after typing a search term
1 parent 1f4278d commit 5b2e477

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/librustdoc/html/static/main.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -605,11 +605,10 @@
605605
// cleared to ensure the search is successful.
606606
currentResults = null;
607607
// Synchronize search bar with query string state and
608-
// perform the search, but don't empty the bar if there's
609-
// nothing there.
610-
if (params.search !== undefined) {
611-
$('.search-input').val(params.search);
612-
}
608+
// perform the search. This will empty the bar if there's
609+
// nothing there, which lets you really go back to a
610+
// previous state with nothing in the bar.
611+
$('.search-input').val(params.search);
613612
// Some browsers fire 'onpopstate' for every page load
614613
// (Chrome), while others fire the event only when actually
615614
// popping a state (Firefox), which is why search() is

0 commit comments

Comments
 (0)