Skip to content

Commit

Permalink
HTML Search: Minor errors are emitted on fetching search snipets
Browse files Browse the repository at this point in the history
  • Loading branch information
tk0miya committed Jun 26, 2022
1 parent 81f20f1 commit 73ccf3a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGES
Expand Up @@ -34,6 +34,7 @@ Bugs fixed
* HTML Search: HTML tags are displayed as a part of object name
* HTML Search: search snipets should not be folded
* HTML Search: The markers for header links are shown in the search result
* HTML Search: Minor errors are emitted on fetching search snipets
* #10520: HTML Theme: Fix use of sidebar classes in ``agogo.css_t``.
* #6679: HTML Theme: Fix inclusion of hidden toctrees in the agogo theme.
* #10566: HTML Theme: Fix enable_search_shortcuts does not work
Expand Down
4 changes: 1 addition & 3 deletions sphinx/themes/basic/static/searchtools.js
Expand Up @@ -155,9 +155,7 @@ const Search = {
_pulse_status: -1,

htmlToText: (htmlString) => {
const htmlElement = document
.createRange()
.createContextualFragment(htmlString);
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;
Expand Down

0 comments on commit 73ccf3a

Please sign in to comment.