diff options
| author | Mark Simulacrum <mark.simulacrum@gmail.com> | 2017-05-13 20:55:12 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-05-13 20:55:12 -0600 |
| commit | 24aba5580532f86a4ef0bf2d3e0475b34664ac97 (patch) | |
| tree | e3353531628a88651f58d295ff2b4112fa79ca1f | |
| parent | e71d4404bd6ad9e282d8efbb20eb8d8c2d13a9a8 (diff) | |
| parent | b09a19b7c73e83a64c8b0020827a0f8fb01550bf (diff) | |
| download | rust-24aba5580532f86a4ef0bf2d3e0475b34664ac97.tar.gz rust-24aba5580532f86a4ef0bf2d3e0475b34664ac97.zip | |
Rollup merge of #41950 - GuillaumeGomez:rustdoc-links, r=frewsxcv
Fix anchor invalid redirection to search Fixes #41933. r? @rust-lang/docs
| -rw-r--r-- | src/librustdoc/html/static/main.js | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js index fbc7615588e..c115a6ccba6 100644 --- a/src/librustdoc/html/static/main.js +++ b/src/librustdoc/html/static/main.js @@ -943,9 +943,9 @@ if (hasClass(main, 'content')) { removeClass(main, 'hidden'); } - var search = document.getElementById('search'); - if (hasClass(main, 'content')) { - addClass(main, 'hidden'); + var search_c = document.getElementById('search'); + if (hasClass(search_c, 'content')) { + addClass(search_c, 'hidden'); } } // Revert to the previous title manually since the History @@ -959,7 +959,11 @@ // 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. - document.getElementsByClassName('search-input')[0].value = params.search; + if (params.search) { + document.getElementsByClassName('search-input')[0].value = params.search; + } else { + document.getElementsByClassName('search-input')[0].value = ''; + } // 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 |
