diff --git a/src/engines/postsearch/docs_rs.rs b/src/engines/postsearch/docs_rs.rs index c5d509e..cc1df32 100644 --- a/src/engines/postsearch/docs_rs.rs +++ b/src/engines/postsearch/docs_rs.rs @@ -35,9 +35,12 @@ pub fn parse_response(body: &str, url: Url) -> Option { let doc_query = Selector::parse(".docblock").unwrap(); - let doc = dom.select(&doc_query).next()?; + let doc_html = dom + .select(&doc_query) + .next() + .map(|doc| doc.inner_html()) + .unwrap_or_default(); - let doc_html = doc.inner_html(); let item_decl = dom .select(&Selector::parse(".item-decl").unwrap()) .next() diff --git a/src/web/assets/script.js b/src/web/assets/script.js index e355837..5156ebb 100644 --- a/src/web/assets/script.js +++ b/src/web/assets/script.js @@ -147,7 +147,7 @@ searchInputEl.addEventListener("input", () => { clearFocusedSuggestion(); updateSuggestions(); }); -// and on focus +// and when they click suggestions searchInputEl.addEventListener("click", updateSuggestions); // on unfocus hide the suggestions searchInputEl.addEventListener("blur", (e) => {