isBlocked factors in the selector (#894)

* isBlocked factors in the selector

* Ensure contains parameter is a node

* Fix blockSelector blocking for closest nodes

* Fix integration test

* adding ignoreCSSAttributes to ignore the addition of certain css attributes

* tested ignoreCSSAttributes

* Update test snapshot

* swapped the wrapping of htmlelement to be element

* Fix linter errors

* Address MR feedback

* Rebase

Co-authored-by: Filip <filipslatinac@gmail.com>
This commit is contained in:
dbseel
2026-04-01 12:00:00 +08:00
committed by GitHub
parent 9529acb47b
commit c94b5783c4
14 changed files with 74 additions and 28 deletions

View File

@@ -581,7 +581,7 @@ exports[`record captures style property changes 1`] = `
\\"source\\": 13,
\\"id\\": 9,
\\"set\\": {
\\"property\\": \\"color\\",
\\"property\\": \\"border-color\\",
\\"value\\": \\"green\\"
},
\\"index\\": [

View File

@@ -385,6 +385,7 @@ describe('record', function (this: ISuite) {
record({
emit: ((window as unknown) as IWindow).emit,
ignoreCSSAttributes: new Set(['color']),
});
const styleElement = document.createElement('style');
@@ -393,10 +394,18 @@ describe('record', function (this: ISuite) {
const styleSheet = <CSSStyleSheet>styleElement.sheet;
styleSheet.insertRule('body { background: #000; }');
setTimeout(() => {
// should be ignored
(styleSheet.cssRules[0] as CSSStyleRule).style.setProperty(
'color',
'green',
);
// should be captured because we did not block it
(styleSheet.cssRules[0] as CSSStyleRule).style.setProperty(
'border-color',
'green',
);
(styleSheet.cssRules[0] as CSSStyleRule).style.removeProperty(
'background',
);