diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2023-03-27 08:46:53 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-03-27 08:46:53 +0200 |
| commit | b39db705f55a2d3aa4d3db63df46e9b66b8af423 (patch) | |
| tree | cbeb8d7371ba8927c6ce39c9fab20b5990bdad99 /src | |
| parent | 04b8523c46f9b5e43c5be0fdcae8fef843166b3f (diff) | |
| parent | bc9eec04b7e9713e7d0bde0ad4f8bfc8574082a6 (diff) | |
| download | rust-b39db705f55a2d3aa4d3db63df46e9b66b8af423.tar.gz rust-b39db705f55a2d3aa4d3db63df46e9b66b8af423.zip | |
Rollup merge of #109633 - GuillaumeGomez:fix-go-to-only-setting, r=notriddle
Fix "Directly go to item in search if there is only one result" setting Part of #66181. The setting was actually broken, so I fixed it when I added the GUI test. r? `@notriddle`
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustdoc/html/static/js/search.js | 6 |
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 840ed8e1080..c081578b8d4 100644 --- a/src/librustdoc/html/static/js/search.js +++ b/src/librustdoc/html/static/js/search.js @@ -1946,11 +1946,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; |
