Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions src/librustdoc/html/static/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -2739,10 +2739,17 @@ function defocusSearchBar() {
});
}

function enableSearchInput() {
if (search_input) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even if very unlikely, I don't like the idea to enable the search input if the other processing isn't done. So instead of just moving this call here, I suggest to put it inside a function and then call this function in the if (!elem) { block and at the end of the addSearchOptions. What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, yes I didn't think about the processing angle, made the change now.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

search_input.removeAttribute('disabled');
}
}

window.addSearchOptions = function(crates) {
var elem = document.getElementById("crate-search");

if (!elem) {
enableSearchInput();
return;
}
var crates_text = [];
Expand Down Expand Up @@ -2780,10 +2787,7 @@ function defocusSearchBar() {
elem.value = savedCrate;
}
}

if (search_input) {
search_input.removeAttribute('disabled');
}
enableSearchInput();
};

function buildHelperPopup() {
Expand Down