Skip to content

Commit

Permalink
allow passing null to maskTextClass/blockClass
Browse files Browse the repository at this point in the history
  • Loading branch information
mdellanoce authored and colingm committed May 1, 2024
1 parent f1e6a51 commit ef203ee
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/quick-cows-chew.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'rrweb-snapshot': patch
---

allow passing null to maskTextClass/blockClass
3 changes: 2 additions & 1 deletion packages/rrweb-snapshot/src/snapshot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ export function _isBlockedElement(
if (element.classList.contains(blockClass)) {
return true;
}
} else {
} else if (blockClass) {
for (let eIndex = element.classList.length; eIndex--; ) {
const className = element.classList[eIndex];
if (blockClass.test(className)) {
Expand All @@ -294,6 +294,7 @@ export function classMatchesRegex(
checkAncestors: boolean,
): boolean {
if (!node) return false;
if (!regex) return false;
if (node.nodeType !== node.ELEMENT_NODE) {
if (!checkAncestors) return false;
return classMatchesRegex(node.parentNode, regex, checkAncestors);
Expand Down

0 comments on commit ef203ee

Please sign in to comment.