]> git.lizzy.rs Git - rust.git/blobdiff - src/librustdoc/html/static/main.js
Add explanations on the results search element check
[rust.git] / src / librustdoc / html / static / main.js
index f465228b7493ee3324095369fa10ed659328ed95..57c8d5bff76739876c002ba463e6048c8f8bd3c4 100644 (file)
@@ -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");