Auto merge of #83028 - GuillaumeGomez:prevent-js-error-if-no-filter, r=Nemo157
Prevent JS error when there is no dependency or other crate documented (or --disable-per-crate-search has been used) When there is only one crate, the dropdown is removed, creating an error (that you can see pretty easily on docs.rs for example). r? `@jyn514`
This commit is contained in:
commit
2caeeb0527
1 changed files with 5 additions and 1 deletions
|
@ -2948,7 +2948,11 @@ function defocusSearchBar() {
|
||||||
search_input.removeAttribute('disabled');
|
search_input.removeAttribute('disabled');
|
||||||
|
|
||||||
var crateSearchDropDown = document.getElementById("crate-search");
|
var crateSearchDropDown = document.getElementById("crate-search");
|
||||||
crateSearchDropDown.addEventListener("focus", loadSearch);
|
// `crateSearchDropDown` can be null in case there is only crate because in that case, the
|
||||||
|
// crate filter dropdown is removed.
|
||||||
|
if (crateSearchDropDown) {
|
||||||
|
crateSearchDropDown.addEventListener("focus", loadSearch);
|
||||||
|
}
|
||||||
var params = getQueryStringParams();
|
var params = getQueryStringParams();
|
||||||
if (params.search !== undefined) {
|
if (params.search !== undefined) {
|
||||||
loadSearch();
|
loadSearch();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue