Skip to content

Commit

Permalink
fix: fix find mode not searching inside elements with display prope…
Browse files Browse the repository at this point in the history
…rty set to `contents`

made the find mode dom node traversal algorithms search for visible nodes inside elements with display property set as contents. This had to be done because the `checkVisibility` method considers these elements as not visible, however the children of these elements are visible.
  • Loading branch information
victoragcosta authored and philc committed Jan 12, 2025
1 parent bf0bdda commit e304d0a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion content_scripts/mode_find.js
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,10 @@ const getAllTextNodes = () => {
function getAllTextNodes(node) {
if (node.nodeType === Node.TEXT_NODE) {
textNodes.push(node);
} else if (node.nodeType === Node.ELEMENT_NODE && node.checkVisibility()) {
} else if (
node.nodeType === Node.ELEMENT_NODE &&
(node.checkVisibility() || node.style.display === "contents")
) {
const children = node.childNodes;
for (const child of children) {
getAllTextNodes(child, textNodes);
Expand Down

0 comments on commit e304d0a

Please sign in to comment.