diff options
author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2022-06-26 17:22:39 +0300 |
---|---|---|
committer | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2022-06-26 17:22:39 +0300 |
commit | 73ccf3a2baba2ec694575c87f769da7d46b442d9 (patch) | |
tree | a4b72fa73603c727d5cc35b2129420cddd384b38 | |
parent | 81f20f1a6b1276ed8ef6cf797b7d38d99b8b635f (diff) |
HTML Search: Minor errors are emitted on fetching search snipetsfix_search
-rw-r--r-- | CHANGES | 1 | ||||
-rw-r--r-- | sphinx/themes/basic/static/searchtools.js | 4 |
2 files changed, 2 insertions, 3 deletions
@@ -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 diff --git a/sphinx/themes/basic/static/searchtools.js b/sphinx/themes/basic/static/searchtools.js index c91278e98..b6bfd2db2 100644 --- a/sphinx/themes/basic/static/searchtools.js +++ b/sphinx/themes/basic/static/searchtools.js @@ -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; |