From 1d2808341a51fe70ea5587b2c111fa4ebf106991 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Thu, 24 Oct 2019 23:02:18 +0200 Subject: [PATCH 1/2] Cleanup search element getter --- 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 a0e07d58c9d..d321307b2e0 100644 --- a/src/librustdoc/html/static/main.js +++ b/src/librustdoc/html/static/main.js @@ -1218,7 +1218,7 @@ function getSearchElement() { } dst = dst[0]; if (window.location.pathname === dst.pathname) { - addClass(document.getElementById("search"), "hidden"); + addClass(getSearchElement(), "hidden"); removeClass(main, "hidden"); document.location.href = dst.href; } @@ -2454,7 +2454,7 @@ function getSearchElement() { function putBackSearch(search_input) { if (search_input.value !== "") { addClass(main, "hidden"); - removeClass(document.getElementById("search"), "hidden"); + removeClass(getSearchElement(), "hidden"); if (browserSupportsHistoryApi()) { history.replaceState(search_input.value, "", From 91ef9600db47e4e91a57909077a60ebec1122d1b Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Fri, 25 Oct 2019 00:35:45 +0200 Subject: [PATCH 2/2] reduce size of generated HTML files by moving the popup helper code to the JS --- src/librustdoc/html/layout.rs | 55 ------------------------------ src/librustdoc/html/static/main.js | 47 +++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 55 deletions(-) diff --git a/src/librustdoc/html/layout.rs b/src/librustdoc/html/layout.rs index 83793f9d821..697dee0216e 100644 --- a/src/librustdoc/html/layout.rs +++ b/src/librustdoc/html/layout.rs @@ -106,61 +106,6 @@ pub fn render(
{content}
\
\
\ - \ {after_content}\