From 777518d84438b416dbdbf44900a32396303c4204 Mon Sep 17 00:00:00 2001 From: Willy Aguirre Date: Thu, 1 Oct 2015 13:30:35 -0500 Subject: [PATCH] fixes #28696 Return to the default content when .search-input is empty -Add a validation when input search is empty on top of 'startSearch()' --- src/librustdoc/html/static/main.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js index 5b0b19b95af..b3d25273d83 100644 --- a/src/librustdoc/html/static/main.js +++ b/src/librustdoc/html/static/main.js @@ -715,6 +715,15 @@ } function startSearch() { + + $(".search-input").on("keyup",function() { + if ($(this).val().length === 0) { + window.history.replaceState("", "std - Rust", "?search="); + $('#main.content').removeClass('hidden'); + $('#search.content').addClass('hidden'); + } + }); + var keyUpTimeout; $('.do-search').on('click', search); $('.search-input').on('keyup', function() {