HTML Search: Minor errors are emitted on fetching search snipets

This commit is contained in:
Takeshi KOMIYA 2022-06-26 23:22:39 +09:00
parent 50897f0cc2
commit 6ed7405cd9
2 changed files with 2 additions and 3 deletions

View File

@ -48,6 +48,7 @@ Bugs fixed
* #10460: logging: Always show node source locations as absolute paths. * #10460: logging: Always show node source locations as absolute paths.
* HTML Search: HTML tags are displayed as a part of object name * HTML Search: HTML tags are displayed as a part of object name
* HTML Search: search snipets should not be folded * HTML Search: search snipets should not be folded
* HTML Search: Minor errors are emitted on fetching search snipets
* #10520: HTML Theme: Fix use of sidebar classes in ``agogo.css_t``. * #10520: HTML Theme: Fix use of sidebar classes in ``agogo.css_t``.
* #6679: HTML Theme: Fix inclusion of hidden toctrees in the agogo theme. * #6679: HTML Theme: Fix inclusion of hidden toctrees in the agogo theme.
* #10566: HTML Theme: Fix enable_search_shortcuts does not work * #10566: HTML Theme: Fix enable_search_shortcuts does not work

View File

@ -155,9 +155,7 @@ const Search = {
_pulse_status: -1, _pulse_status: -1,
htmlToText: (htmlString) => { htmlToText: (htmlString) => {
const htmlElement = document const htmlElement = new DOMParser().parseFromString(htmlString, 'text/html');
.createRange()
.createContextualFragment(htmlString);
htmlElement.querySelectorAll(".headerlink").forEach((el) => el.parentNode.removeChild(el)); htmlElement.querySelectorAll(".headerlink").forEach((el) => el.parentNode.removeChild(el));
const docContent = htmlElement.querySelector('[role="main"]'); const docContent = htmlElement.querySelector('[role="main"]');
if (docContent !== undefined) return docContent.textContent; if (docContent !== undefined) return docContent.textContent;