Skip to content

Commit

Permalink
Fix usability problem when browse document locally
Browse files Browse the repository at this point in the history
  • Loading branch information
bombless committed Mar 17, 2016
1 parent abb1515 commit 2910c00
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/librustdoc/html/static/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -740,7 +740,11 @@
$(".search-input").on("keyup input",function() {
clearTimeout(searchTimeout);
if ($(this).val().length === 0) {
window.history.replaceState("", "std - Rust", "?search=");
if (browserSupportsHistoryApi()) {
history.replaceState("", "std - Rust", "?search=");
} else {
location.replace("?search=");
}
$('#main.content').removeClass('hidden');
$('#search.content').addClass('hidden');
} else {
Expand Down Expand Up @@ -996,7 +1000,7 @@
var prev_id = 0;

function set_fragment(name) {
if (history.replaceState) {
if (browserSupportsHistoryApi()) {
history.replaceState(null, null, '#' + name);
$(window).trigger('hashchange');
} else {
Expand Down

0 comments on commit 2910c00

Please sign in to comment.