summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2022-06-26 23:22:39 +0900
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2022-07-18 23:05:57 +0900
commit6ed7405cd9da2ba78f54f90e2decf895cbc25bf2 (patch)
tree69526eba7603321fd887fbd37af868665967cc26
parent50897f0cc248241067d520fede5e5b9f6aca0175 (diff)
downloadsphinx-git-6ed7405cd9da2ba78f54f90e2decf895cbc25bf2.tar.gz
HTML Search: Minor errors are emitted on fetching search snipets
-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 dea7f9408..5692d38f1 100644
--- a/CHANGES
+++ b/CHANGES
@@ -48,6 +48,7 @@ Bugs fixed
* #10460: logging: Always show node source locations as absolute paths.
* HTML Search: HTML tags are displayed as a part of object name
* 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``.
* #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 563e50af7..f656da73b 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.parentNode.removeChild(el));
const docContent = htmlElement.querySelector('[role="main"]');
if (docContent !== undefined) return docContent.textContent;