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
|
@ -2948,7 +2948,11 @@ function defocusSearchBar() {
|
|||
search_input.removeAttribute('disabled');
|
||||
|
||||
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();
|
||||
if (params.search !== undefined) {
|
||||
loadSearch();
|
||||
|
|
Loading…
Reference in New Issue