Skip to content

Commit

Permalink
Rollup merge of rust-lang#41950 - GuillaumeGomez:rustdoc-links, r=fre…
Browse files Browse the repository at this point in the history
…wsxcv

Fix anchor invalid redirection to search

Fixes rust-lang#41933.

r? @rust-lang/docs
  • Loading branch information
Mark-Simulacrum authored May 13, 2017
2 parents 38ccafc + b09a19b commit e7c4628
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/librustdoc/html/static/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit e7c4628

Please sign in to comment.