Skip to content

Commit 532bb05

Browse files
committed
Ignore hidden nodes
1 parent 0721107 commit 532bb05

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

devdocs-macos/user-scripts/page-search.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,10 @@
8484
if (parent.tagName === 'MARK') {
8585
return NodeFilter.FILTER_REJECT;
8686
}
87+
// The node is not visible on the page.
88+
if (parent.offsetParent === null) {
89+
return NodeFilter.FILTER_REJECT;
90+
}
8791
let content = node.textContent;
8892
if (parent.hasAttribute(DATA_TEXTCONTENT)) {
8993
content = parent.getAttribute(DATA_TEXTCONTENT);

0 commit comments

Comments
 (0)