Skip to content

Commit

Permalink
rustdoc: Make going back in browser history work after typing a searc…
Browse files Browse the repository at this point in the history
…h term
  • Loading branch information
noamraph committed Apr 28, 2014
1 parent 1f4278d commit 5b2e477
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/librustdoc/html/static/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -605,11 +605,10 @@
// cleared to ensure the search is successful.
currentResults = null;
// Synchronize search bar with query string state and
// perform the search, but don't empty the bar if there's
// nothing there.
if (params.search !== undefined) {
$('.search-input').val(params.search);
}
// perform the search. This will empty the bar if there's
// nothing there, which lets you really go back to a
// previous state with nothing in the bar.
$('.search-input').val(params.search);
// Some browsers fire 'onpopstate' for every page load
// (Chrome), while others fire the event only when actually
// popping a state (Firefox), which is why search() is
Expand Down

0 comments on commit 5b2e477

Please sign in to comment.