From 1727c7a194187af70f44f3f5b160eea8439cbc6d Mon Sep 17 00:00:00 2001 From: Guillaume Gomez <guillaume1.gomez@gmail.com> Date: Thu, 27 Aug 2020 12:56:43 +0200 Subject: [PATCH 1/2] Improve helper wording --- src/librustdoc/html/static/main.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js index 462a696dee6ef..c2c482cd455f3 100644 --- a/src/librustdoc/html/static/main.js +++ b/src/librustdoc/html/static/main.js @@ -2797,8 +2797,8 @@ function defocusSearchBar() { var infos = [ "Prefix searches with a type followed by a colon (e.g., <code>fn:</code>) to \ - restrict the search to a given type.", - "Accepted types are: <code>fn</code>, <code>mod</code>, <code>struct</code>, \ + restrict the search to a given item kind.", + "Accepted kinds are: <code>fn</code>, <code>mod</code>, <code>struct</code>, \ <code>enum</code>, <code>trait</code>, <code>type</code>, <code>macro</code>, \ and <code>const</code>.", "Search functions by type signature (e.g., <code>vec -> usize</code> or \ From 86e42c2742423aacbf70ba49c499a83846f57712 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez <guillaume1.gomez@gmail.com> Date: Thu, 27 Aug 2020 13:34:35 +0200 Subject: [PATCH 2/2] Delay help popup creation to when it's needed --- src/librustdoc/html/static/main.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js index c2c482cd455f3..e31b61b2cdda6 100644 --- a/src/librustdoc/html/static/main.js +++ b/src/librustdoc/html/static/main.js @@ -344,6 +344,7 @@ function defocusSearchBar() { } function getHelpElement() { + buildHelperPopup(); return document.getElementById("help"); } @@ -2818,12 +2819,12 @@ function defocusSearchBar() { popup.appendChild(container); insertAfter(popup, getSearchElement()); + // So that it's only built once and then it'll do nothing when called! + buildHelperPopup = function() {}; } onHashChange(null); window.onhashchange = onHashChange; - - buildHelperPopup(); }()); // This is required in firefox. Explanations: when going back in the history, firefox doesn't re-run