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 Feb 13, 2023
1 parent 84ecbf2 commit f55c4a2
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 @@ -372,12 +372,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 f55c4a2

Please sign in to comment.