diff options
| author | Adam Turner <9087854+aa-turner@users.noreply.github.com> | 2022-07-18 22:49:56 +0100 |
|---|---|---|
| committer | Adam Turner <9087854+aa-turner@users.noreply.github.com> | 2022-07-18 22:49:56 +0100 |
| commit | 94024e6efaa23869a6141dba05118c158d3d3f8f (patch) | |
| tree | 1bfccc5447ca099627c4c31f536d7082b7b9eb6a /sphinx/themes | |
| parent | a4d41aa889388bf8ee2815d4819235b5ca978a8d (diff) | |
| parent | eb0a6c574fd18d5c5d903e5d07cba8cafc376ee0 (diff) | |
| download | sphinx-git-94024e6efaa23869a6141dba05118c158d3d3f8f.tar.gz | |
Merge branch '5.x'
# Conflicts:
# sphinx/ext/autodoc/__init__.py
# sphinx/writers/html5.py
Diffstat (limited to 'sphinx/themes')
| -rw-r--r-- | sphinx/themes/basic/static/searchtools.js | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/sphinx/themes/basic/static/searchtools.js b/sphinx/themes/basic/static/searchtools.js index 5ed91c92d..f2fb7d5cf 100644 --- a/sphinx/themes/basic/static/searchtools.js +++ b/sphinx/themes/basic/static/searchtools.js @@ -88,7 +88,7 @@ const _displayItem = (item, highlightTerms, searchTerms) => { linkEl.href = linkUrl + "?" + params.toString() + anchor; linkEl.innerHTML = title; if (descr) - listItem.appendChild(document.createElement("span")).innerText = + listItem.appendChild(document.createElement("span")).innerHTML = " (" + descr + ")"; else if (showSearchSummary) fetch(requestUrl) @@ -155,10 +155,8 @@ const Search = { _pulse_status: -1, htmlToText: (htmlString) => { - const htmlElement = document - .createRange() - .createContextualFragment(htmlString); - htmlElement.querySelectorAll(".headerlink").forEach((el) => el.parentNode.removeChild(el)); + 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; console.warn( @@ -519,7 +517,7 @@ const Search = { let summary = document.createElement("p"); summary.classList.add("context"); - summary.innerText = top + text.substr(startWithContext, 240).trim() + tail; + summary.textContent = top + text.substr(startWithContext, 240).trim() + tail; highlightWords.forEach((highlightWord) => _highlightText(summary, highlightWord, "highlighted") |
