From 5b2e4776296a23cc6429838e8ba47c3d42513004 Mon Sep 17 00:00:00 2001 From: Noam Yorav-Raphael Date: Mon, 28 Apr 2014 23:52:54 +0300 Subject: [PATCH] rustdoc: Make going back in browser history work after typing a search term --- src/librustdoc/html/static/main.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js index e975fac6ed7..21d57a17c67 100644 --- a/src/librustdoc/html/static/main.js +++ b/src/librustdoc/html/static/main.js @@ -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