Skip to content

Commit c3a8d22

Browse files
committed
allow passing null to maskTextClass/blockClass
1 parent a2e7ddd commit c3a8d22

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

.changeset/quick-cows-chew.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'rrweb-snapshot': patch
3+
---
4+
5+
allow passing null to maskTextClass/blockClass

packages/rrweb-snapshot/src/snapshot.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ export function _isBlockedElement(
268268
if (element.classList.contains(blockClass)) {
269269
return true;
270270
}
271-
} else {
271+
} else if (blockClass) {
272272
for (let eIndex = element.classList.length; eIndex--; ) {
273273
const className = element.classList[eIndex];
274274
if (blockClass.test(className)) {
@@ -292,6 +292,7 @@ export function classMatchesRegex(
292292
checkAncestors: boolean,
293293
): boolean {
294294
if (!node) return false;
295+
if (!regex) return false;
295296
if (node.nodeType !== node.ELEMENT_NODE) {
296297
if (!checkAncestors) return false;
297298
return classMatchesRegex(node.parentNode, regex, checkAncestors);

0 commit comments

Comments
 (0)