Skip to content

Commit

Permalink
feat: Add unblockSelector option
Browse files Browse the repository at this point in the history
This would allow you to broadly block elements and selectively unblock elements.
  • Loading branch information
billyvg committed Aug 7, 2023
1 parent c17c1a8 commit 6692c9c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
4 changes: 3 additions & 1 deletion packages/rrweb-snapshot/test/snapshot.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ describe('transformAttribute()', () => {

describe('isBlockedElement()', () => {
const subject = (html: string, opt: any = {}) =>
_isBlockedElement(render(html), 'rr-block', opt.blockSelector);
_isBlockedElement(render(html), 'rr-block', opt.blockSelector, opt.unblockSelector);

const render = (html: string): HTMLElement =>
JSDOM.fragment(html).querySelector('div')!;
Expand Down Expand Up @@ -189,6 +189,7 @@ describe('style elements', () => {
mirror: new Mirror(),
blockClass: 'blockblock',
blockSelector: null,
unblockSelector: null,
maskAllText: false,
maskTextClass: 'maskmask',
unmaskTextClass: 'unmaskmask',
Expand Down Expand Up @@ -238,6 +239,7 @@ describe('scrollTop/scrollLeft', () => {
mirror: new Mirror(),
blockClass: 'blockblock',
blockSelector: null,
unblockSelector: null,
maskAllText: false,
maskTextClass: 'maskmask',
unmaskTextClass: 'unmaskmask',
Expand Down
18 changes: 17 additions & 1 deletion packages/rrweb/test/__snapshots__/integration.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -6858,7 +6858,7 @@ exports[`record integration tests mutations should work when blocked class is un
\\"attributes\\": {
\\"class\\": \\"rr-block\\",
\\"rr_width\\": \\"1904px\\",
\\"rr_height\\": \\"21.5px\\"
\\"rr_height\\": \\"21px\\"
},
\\"childNodes\\": [],
\\"id\\": 84
Expand Down Expand Up @@ -10636,6 +10636,14 @@ exports[`record integration tests should nest record iframe 1`] = `
\\"attributes\\": [],
\\"isAttachIframe\\": true
}
},
{
\\"type\\": 3,
\\"data\\": {
\\"source\\": 4,
\\"width\\": 1920,
\\"height\\": 1080
}
}
]"
`;
Expand Down Expand Up @@ -18925,6 +18933,14 @@ exports[`record integration tests should record nested iframes and shadow doms 1
\\"isAttachIframe\\": true
}
},
{
\\"type\\": 3,
\\"data\\": {
\\"source\\": 4,
\\"width\\": 1920,
\\"height\\": 1080
}
},
{
\\"type\\": 3,
\\"data\\": {
Expand Down

0 comments on commit 6692c9c

Please sign in to comment.