Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Searchtools: don't assume that all themes define some elements #10153

Merged
merged 2 commits into from Apr 4, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 6 additions & 4 deletions sphinx/themes/basic/static/searchtools.js
Expand Up @@ -48,7 +48,7 @@ if (!Scorer) {
}

const _removeChildren = (element) => {
while (element.lastChild) element.removeChild(element.lastChild);
while (element && element.lastChild) element.removeChild(element.lastChild);
tk0miya marked this conversation as resolved.
Show resolved Hide resolved
};

/**
Expand Down Expand Up @@ -208,9 +208,11 @@ const Search = {
Search.status = out.appendChild(searchSummary);
Search.output = out.appendChild(searchList);

document.getElementById("search-progress").innerText = _(
"Preparing search..."
);
const searchProgress = document.getElementById("search-progress");
// Not all themes may have this element.
stsewd marked this conversation as resolved.
Show resolved Hide resolved
if (searchProgress) {
searchProgress.innerText = _("Preparing search...");
}
Search.startPulse();

// index already loaded, the browser was quick!
Expand Down