about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume.gomez@huawei.com>2023-03-26 17:50:02 +0200
committerGuillaume Gomez <guillaume.gomez@huawei.com>2023-03-26 17:50:09 +0200
commit28982a1e471e7dad82f3f1c1f0a9e9d15d3495d5 (patch)
tree08ce528d3598edd4c7e5d7400ab5f33cb89b1075 /src
parent16bb7196a8d354feebcee986a73dd465d1caa6d8 (diff)
downloadrust-28982a1e471e7dad82f3f1c1f0a9e9d15d3495d5.tar.gz
rust-28982a1e471e7dad82f3f1c1f0a9e9d15d3495d5.zip
Fix "Directly go to item in search if there is only one result" setting
Diffstat (limited to 'src')
-rw-r--r--src/librustdoc/html/static/js/search.js6
1 files changed, 1 insertions, 5 deletions
diff --git a/src/librustdoc/html/static/js/search.js b/src/librustdoc/html/static/js/search.js
index 36ff20e299e..d764981c3cf 100644
--- a/src/librustdoc/html/static/js/search.js
+++ b/src/librustdoc/html/static/js/search.js
@@ -1888,11 +1888,7 @@ function initSearch(rawSearchIndex) {
     function showResults(results, go_to_first, filterCrates) {
         const search = searchState.outputElement();
         if (go_to_first || (results.others.length === 1
-            && getSettingValue("go-to-only-result") === "true"
-            // By default, the search DOM element is "empty" (meaning it has no children not
-            // text content). Once a search has been run, it won't be empty, even if you press
-            // ESC or empty the search input (which also "cancels" the search).
-            && (!search.firstChild || search.firstChild.innerText !== searchState.loadingText))
+            && getSettingValue("go-to-only-result") === "true")
         ) {
             const elem = document.createElement("a");
             elem.href = results.others[0].href;