From 17d40c6057c88f4c432b0d7bac88e1b84cb7e67f Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:03:36 +0200 Subject: Adding upstream version 1.65.0+dfsg1. Signed-off-by: Daniel Baumann --- src/librustdoc/html/static/js/search.js | 31 +++++++++---------------------- 1 file changed, 9 insertions(+), 22 deletions(-) (limited to 'src/librustdoc/html/static/js/search.js') diff --git a/src/librustdoc/html/static/js/search.js b/src/librustdoc/html/static/js/search.js index 75c7bd45a..d04ec357c 100644 --- a/src/librustdoc/html/static/js/search.js +++ b/src/librustdoc/html/static/js/search.js @@ -429,9 +429,9 @@ function initSearch(rawSearchIndex) { } const posBefore = parserState.pos; getNextElem(query, parserState, elems, endChar === ">"); - // This case can be encountered if `getNextElem` encounted a "stop character" right from - // the start. For example if you have `,,` or `<>`. In this case, we simply move up the - // current position to continue the parsing. + // This case can be encountered if `getNextElem` encountered a "stop character" right + // from the start. For example if you have `,,` or `<>`. In this case, we simply move up + // the current position to continue the parsing. if (posBefore === parserState.pos) { parserState.pos += 1; } @@ -581,7 +581,7 @@ function initSearch(rawSearchIndex) { const elem = document.getElementById("crate-search"); if (elem && - elem.value !== "All crates" && + elem.value !== "all crates" && hasOwnPropertyRustdoc(rawSearchIndex, elem.value) ) { return elem.value; @@ -1551,12 +1551,6 @@ function initSearch(rawSearchIndex) { return [displayPath, href]; } - function escape(content) { - const h1 = document.createElement("h1"); - h1.textContent = content; - return h1.innerHTML; - } - function pathSplitter(path) { const tmp = "" + path.replace(/::/g, "::"); if (tmp.endsWith("")) { @@ -1710,22 +1704,15 @@ function initSearch(rawSearchIndex) { let crates = ""; const crates_list = Object.keys(rawSearchIndex); if (crates_list.length > 1) { - crates = " in " + + ""; for (const c of crates_list) { crates += ``; } - crates += ""; - } - - let typeFilter = ""; - if (results.query.typeFilter !== NO_TYPE_FILTER) { - typeFilter = " (type: " + escape(itemTypes[results.query.typeFilter]) + ")"; + crates += ""; } - let output = "
" + - `

Results for ${escape(results.query.userQuery)}` + - `${typeFilter}

${crates}
`; + let output = `

Results${crates}

`; if (results.query.error !== null) { output += `

Query parser error: "${results.query.error}".

`; output += "
" + @@ -2245,7 +2232,7 @@ function initSearch(rawSearchIndex) { } function updateCrate(ev) { - if (ev.target.value === "All crates") { + if (ev.target.value === "all crates") { // If we don't remove it from the URL, it'll be picked up again by the search. const params = searchState.getQueryStringParams(); const query = searchState.input.value.trim(); -- cgit v1.2.3