Skip to content

Commit

Permalink
fix: Exclude all nested elements (#450)
Browse files Browse the repository at this point in the history
  • Loading branch information
bencefr authored Feb 2, 2024
1 parent c17412b commit 7df9ad7
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions src/utils/helpers.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,9 @@ export const isExcludedNode = (
node: HTMLElement,
excluded: string[],
): boolean => {
const targetTagName = node.tagName.toUpperCase();
const isExcludedTag = excluded.find(
(tag) => tag.toUpperCase() === targetTagName,
return excluded.some((exclude) =>
node.matches(`${exclude}, .${exclude}, ${exclude} *, .${exclude} *`),
);

if (isExcludedTag) return true;

const isExcludedClassName = excluded.find((className) =>
node.classList.contains(className),
);

if (isExcludedClassName) return true;

return false;
};

export const cancelTimeout = (
Expand Down

0 comments on commit 7df9ad7

Please sign in to comment.