about summary refs log tree commit diff
path: root/src/librustdoc/html
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-11-12 13:10:07 +0000
committerbors <bors@rust-lang.org>2020-11-12 13:10:07 +0000
commit7f5a42b073dc2bee2aa625052eb066ee07072048 (patch)
treeaa2c47a52e7b3637d4602303b4e9b7890e324da3 /src/librustdoc/html
parent12f0dba618e761c987142474435dff95ab177f3c (diff)
parentcac8ac61dd3918aa771bbc97d2cb9e82901d101d (diff)
downloadrust-7f5a42b073dc2bee2aa625052eb066ee07072048.tar.gz
rust-7f5a42b073dc2bee2aa625052eb066ee07072048.zip
Auto merge of #78976 - GuillaumeGomez:rollup-endkih3, r=GuillaumeGomez
Rollup of 5 pull requests

Successful merges:

 - #78916 (extend const generics test suite)
 - #78921 (Improve the page title switch handling between search and doc)
 - #78933 (Don't print thread ids and names in `tracing` logs)
 - #78960 (Test default values for const parameters.)
 - #78971 (Update books)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'src/librustdoc/html')
-rw-r--r--src/librustdoc/html/static/main.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js
index 10342679cf4..cbf15cd0b6e 100644
--- a/src/librustdoc/html/static/main.js
+++ b/src/librustdoc/html/static/main.js
@@ -113,6 +113,7 @@ function defocusSearchBar() {
     var mouseMovedAfterSearch = true;
 
     var titleBeforeSearch = document.title;
+    var searchTitle = null;
 
     function clearInputTimeout() {
         if (searchTimeout !== null) {
@@ -169,6 +170,7 @@ function defocusSearchBar() {
         addClass(main, "hidden");
         removeClass(search, "hidden");
         mouseMovedAfterSearch = false;
+        document.title = searchTitle;
     }
 
     function hideSearchResults(search) {
@@ -177,6 +179,7 @@ function defocusSearchBar() {
         }
         addClass(search, "hidden");
         removeClass(main, "hidden");
+        document.title = titleBeforeSearch;
     }
 
     // used for special search precedence
@@ -374,7 +377,6 @@ function defocusSearchBar() {
             clearInputTimeout();
             ev.preventDefault();
             hideSearchResults(search);
-            document.title = titleBeforeSearch;
         }
         defocusSearchBar();
         hideThemeButtonState();
@@ -1791,7 +1793,7 @@ function defocusSearchBar() {
             }
 
             // Update document title to maintain a meaningful browser history
-            document.title = "Results for " + query.query + " - Rust";
+            searchTitle = "Results for " + query.query + " - Rust";
 
             // Because searching is incremental by character, only the most
             // recent search query is added to the browser history.
@@ -2745,6 +2747,7 @@ function defocusSearchBar() {
                                      "",
                                      "?search=" + encodeURIComponent(search_input.value));
             }
+            document.title = searchTitle;
         }
     }