Merge pull request #10153 from stsewd/check-if-search-progress-exists

Searchtools: don't assume that all themes define some elements
This commit is contained in:
Takeshi KOMIYA 2022-04-05 02:33:04 +09:00 committed by GitHub
commit b4276edd84
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -48,7 +48,7 @@ if (typeof Scorer === "undefined") {
} }
const _removeChildren = (element) => { const _removeChildren = (element) => {
while (element.lastChild) element.removeChild(element.lastChild); while (element && element.lastChild) element.removeChild(element.lastChild);
}; };
/** /**
@ -223,9 +223,11 @@ const Search = {
Search.status = out.appendChild(searchSummary); Search.status = out.appendChild(searchSummary);
Search.output = out.appendChild(searchList); Search.output = out.appendChild(searchList);
document.getElementById("search-progress").innerText = _( const searchProgress = document.getElementById("search-progress");
"Preparing search..." // Some themes don't use the search progress node
); if (searchProgress) {
searchProgress.innerText = _("Preparing search...");
}
Search.startPulse(); Search.startPulse();
// index already loaded, the browser was quick! // index already loaded, the browser was quick!