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 committed Dec 12, 2023
1 parent a2e7ddd commit c3a8d22
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 @@ -268,7 +268,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 @@ -292,6 +292,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 c3a8d22

Please sign in to comment.