Skip to content

Commit

Permalink
Add explanations on the results search element check
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Aug 24, 2020
1 parent 6cb364c commit 76bd5b3
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/librustdoc/html/static/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -1579,6 +1579,9 @@ function defocusSearchBar() {
var search = getSearchElement();
if (results.others.length === 1
&& getCurrentValue("rustdoc-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 !== getSearchLoadingText()))
{
var elem = document.createElement("a");
Expand Down

0 comments on commit 76bd5b3

Please sign in to comment.