searchtools: Use the correct check for docContent (#11885)

Co-authored-by: Konstantin Knuetel <konstantin.knuetel@pdfforge.org>
This commit is contained in:
k | c | a 2024-01-21 05:01:33 +01:00 committed by GitHub
parent 360c7a8022
commit 7041f11fb0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -164,7 +164,7 @@ const Search = {
const htmlElement = new DOMParser().parseFromString(htmlString, 'text/html');
htmlElement.querySelectorAll(".headerlink").forEach((el) => { el.remove() });
const docContent = htmlElement.querySelector('[role="main"]');
if (docContent !== undefined) return docContent.textContent;
if (docContent) return docContent.textContent;
console.warn(
"Content block not found. Sphinx search tries to obtain it via '[role=main]'. Could you check your theme or template."
);