Skip to content

Commit 76bd5b3

Browse files
Add explanations on the results search element check
1 parent 6cb364c commit 76bd5b3

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/librustdoc/html/static/main.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1579,6 +1579,9 @@ function defocusSearchBar() {
15791579
var search = getSearchElement();
15801580
if (results.others.length === 1
15811581
&& getCurrentValue("rustdoc-go-to-only-result") === "true"
1582+
// By default, the search DOM element is "empty" (meaning it has no children not
1583+
// text content). Once a search has been run, it won't be empty, even if you press
1584+
// ESC or empty the search input (which also "cancels" the search).
15821585
&& (!search.firstChild || search.firstChild.innerText !== getSearchLoadingText()))
15831586
{
15841587
var elem = document.createElement("a");

0 commit comments

Comments
 (0)