fix(browser-extension): child nodes issue

This commit is contained in:
wanhose 2023-06-11 12:19:36 +02:00
parent dcc9dfef21
commit 2ef1b02383

View File

@ -118,7 +118,7 @@ function isInViewport(node) {
*/
function match(node, skipMatch) {
if (!node instanceof HTMLElement) {
if (!node instanceof HTMLElement || !node.tagName) {
return false;
}
@ -126,7 +126,7 @@ function match(node, skipMatch) {
return false;
}
if (flatNode(node).every((x) => x === Node.TEXT_NODE)) {
if (node.childNodes.length && flatNode(node).every((x) => x === Node.TEXT_NODE)) {
return false;
}