Skip to content

Commit 0cd3874

Browse files
committed
rustdoc: clean up redundant search hiding results code
* There's no need to call `history.replaceState` right before calling `searchState.hideResults`, which already does it. * There's no need to implement hiding search results when that is already implemented.
1 parent 9d69ee0 commit 0cd3874

File tree

2 files changed

+1
-8
lines changed

2 files changed

+1
-8
lines changed

src/librustdoc/html/static/js/main.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -375,10 +375,7 @@ function preLoadCss(cssUrl) {
375375

376376
function handleEscape(ev) {
377377
searchState.clearInputTimeout();
378-
switchDisplayedElement(null);
379-
if (browserSupportsHistoryApi()) {
380-
history.replaceState(null, "", getNakedUrl() + window.location.hash);
381-
}
378+
searchState.hideResults();
382379
ev.preventDefault();
383380
searchState.defocus();
384381
window.hideAllModals(true); // true = reset focus for tooltips

src/librustdoc/html/static/js/search.js

-4
Original file line numberDiff line numberDiff line change
@@ -2412,10 +2412,6 @@ function initSearch(rawSearchIndex) {
24122412
const searchAfter500ms = () => {
24132413
searchState.clearInputTimeout();
24142414
if (searchState.input.value.length === 0) {
2415-
if (browserSupportsHistoryApi()) {
2416-
history.replaceState(null, window.currentCrate + " - Rust",
2417-
getNakedUrl() + window.location.hash);
2418-
}
24192415
searchState.hideResults();
24202416
} else {
24212417
searchState.timeout = setTimeout(search, 500);

0 commit comments

Comments
 (0)