Skip to content

Commit

Permalink
Merge pull request #10153 from stsewd/check-if-search-progress-exists
Browse files Browse the repository at this point in the history
Searchtools: don't assume that all themes define some elements
  • Loading branch information
tk0miya committed Apr 4, 2022
2 parents dd8d029 + a45e4d4 commit b4276ed
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions sphinx/themes/basic/static/searchtools.js
Expand Up @@ -48,7 +48,7 @@ if (typeof Scorer === "undefined") {
}

const _removeChildren = (element) => {
while (element.lastChild) element.removeChild(element.lastChild);
while (element && element.lastChild) element.removeChild(element.lastChild);
};

/**
Expand Down Expand Up @@ -223,9 +223,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");
// Some themes don't use the search progress node
if (searchProgress) {
searchProgress.innerText = _("Preparing search...");
}
Search.startPulse();

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

0 comments on commit b4276ed

Please sign in to comment.