Skip to content

Commit 28982a1

Browse files
Fix "Directly go to item in search if there is only one result" setting
1 parent 16bb719 commit 28982a1

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

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

+1-5
Original file line numberDiff line numberDiff line change
@@ -1888,11 +1888,7 @@ function initSearch(rawSearchIndex) {
18881888
function showResults(results, go_to_first, filterCrates) {
18891889
const search = searchState.outputElement();
18901890
if (go_to_first || (results.others.length === 1
1891-
&& getSettingValue("go-to-only-result") === "true"
1892-
// By default, the search DOM element is "empty" (meaning it has no children not
1893-
// text content). Once a search has been run, it won't be empty, even if you press
1894-
// ESC or empty the search input (which also "cancels" the search).
1895-
&& (!search.firstChild || search.firstChild.innerText !== searchState.loadingText))
1891+
&& getSettingValue("go-to-only-result") === "true")
18961892
) {
18971893
const elem = document.createElement("a");
18981894
elem.href = results.others[0].href;

0 commit comments

Comments
 (0)