Skip to content

Commit 51785ec

Browse files
committed
Use textContent in filter search.
Unlink `innerText`, `textContent` always return the content for hidden elements.
1 parent a0e9731 commit 51785ec

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

lib/ffdocs/view/javascript/front-search.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,7 @@ class FrontSearchInput extends SearchInput {
9595
collectItemData() {
9696
let items = []
9797
for(const elem of document.querySelectorAll("nav details a")) {
98-
// To get the name of the item we have to use firstChild, since some
99-
// Chromium-based browser does not support innerText on hidden elements.
100-
let name = elem.firstChild.nodeValue;
98+
let name = elem.textContent;
10199

102100
items.push({
103101
name,

lib/ffdocs/view/javascript/nav-search.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class NavSearchInput extends SearchInput {
4848

4949
// Hide links that does not contains the words in the input.
5050
for(const elem of document.querySelectorAll("nav details a, nav details .version-label")) {
51-
let link = elem.innerText;
51+
let link = elem.textContent;
5252
let visible = words.every(w => link.includes(w));
5353
elem.classList.toggle("hidden", !visible);
5454

0 commit comments

Comments
 (0)