未验证 提交 e279bd53 编写于 作者: R Ralf Jung 提交者: GitHub

Rollup merge of #72272 - GuillaumeGomez:fix-back-on-page-with-search-behaviour, r=kinnison

Fix going back in history to a search result page on firefox

This bug was actually firefox not re-running JS script when you go back in history. To trigger it on the current docs:

 * Make a search
 * Pick an element (which isn't on the same page as the current element!)
 * Go back in history

Instead of having the search results, you'll see the normal doc page. You can find a small explanation about it [here](http://web.archive.org/web/20100428053932/http://www.firefoxanswer.com/firefox/672-firefoxanswer.html).

r? @kinnison

cc @ollie27
......@@ -2787,3 +2787,9 @@ function focusSearchBar() {
function defocusSearchBar() {
getSearchInput().blur();
}
// This is required in firefox. Explanations: when going back in the history, firefox doesn't re-run
// the JS, therefore preventing rustdoc from setting a few things required to be able to reload the
// previous search results (if you navigated to a search result with the keyboard, pressed enter on
// it to navigate to that result, and then came back to this page).
window.onunload = function(){};
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册