]> git.lizzy.rs Git - rust.git/commitdiff
Add explanations on the results search element check
authorGuillaume Gomez <guillaume1.gomez@gmail.com>
Mon, 24 Aug 2020 10:59:16 +0000 (12:59 +0200)
committerGuillaume Gomez <guillaume1.gomez@gmail.com>
Mon, 24 Aug 2020 10:59:16 +0000 (12:59 +0200)
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");