Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/sphinx-doc/sphinx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2022-06-26 17:22:39 +0300
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2022-06-26 17:22:39 +0300
commit73ccf3a2baba2ec694575c87f769da7d46b442d9 (patch)
treea4b72fa73603c727d5cc35b2129420cddd384b38
parent81f20f1a6b1276ed8ef6cf797b7d38d99b8b635f (diff)
HTML Search: Minor errors are emitted on fetching search snipetsfix_search
-rw-r--r--CHANGES1
-rw-r--r--sphinx/themes/basic/static/searchtools.js4
2 files changed, 2 insertions, 3 deletions
diff --git a/CHANGES b/CHANGES
index 9a3c9112f..4c7389689 100644
--- a/CHANGES
+++ b/CHANGES
@@ -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;