Skip to content

Commit

Permalink
skip mask distance if unmask is not found and maskAllText is true rrw…
Browse files Browse the repository at this point in the history
  • Loading branch information
mdellanoce committed Nov 7, 2023
1 parent 12cf430 commit bb92a19
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/rrweb-snapshot/src/snapshot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -383,12 +383,18 @@ export function needMaskingText(
: node.parentElement;
if (el === null) return false;

const maskDistance = distanceToMatch(el, maskTextClass, maskTextSelector);
const unmaskDistance = distanceToMatch(
el,
unmaskTextClass,
unmaskTextSelector,
);

let maskDistance = -1;
if (maskAllText && unmaskDistance < 0) {
return true;
}

maskDistance = distanceToMatch(el, maskTextClass, maskTextSelector);

return maskDistance >= 0
? unmaskDistance >= 0
Expand Down

0 comments on commit bb92a19

Please sign in to comment.