Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
203 commits
Select commit Hold shift + click to select a range
539f7c8
update typings
Yuyz0112 Apr 4, 2022
e4f680e
Remove INode (`node.__sn`) and use Mirror as source of truth (#868)
Juice10 Apr 6, 2022
93fec1f
Fix mutation edge case when blocked class gets unblocked (#867)
rahulrelicx Apr 15, 2022
e238462
Record canvas snapshots N times per second (#859)
Juice10 Apr 18, 2022
a0e6641
Test: Stylesheet append text node (#886)
Juice10 May 5, 2022
3cdcb8a
Fix for issue #890 (#891)
dkozlovskyi May 9, 2022
69499be
Perf: Apply the latest text mutation only (#885)
Juice10 May 9, 2022
de755ae
#853 Second try: fast-forward implementation v2: virtual dom optimiza…
Juice10 May 12, 2022
a43d4e4
Introduce benchmark tests and improve snapshot attributes traversing …
Yuyz0112 May 14, 2022
1355917
Chore: Add issue/pr template and general housekeeping tools and docs …
Juice10 May 22, 2022
9da1e43
Fix #904 (#906)
Juice10 May 31, 2022
9e249b9
Bump minimist from 1.2.5 to 1.2.6 (#902)
dependabot[bot] Jun 5, 2022
058c457
Speed up snapshotting of many new dom nodes (#903)
Juice10 Jun 6, 2022
0fb8a6b
Update dive-into-event.md (#914)
eliyabar Jun 16, 2022
74f553a
move browser-only rrdom features to the new rrdom package (#913)
Yuyz0112 Jun 20, 2022
d351105
integrate turborepo in monorepo (#918)
Yuyz0112 Jun 20, 2022
af8ed55
unify typescript version and rollup plugins (#921)
Yuyz0112 Jun 25, 2022
c81e609
Lock yarn to 1.23.0 (#922)
Juice10 Jun 30, 2022
a31e272
Remove children of Document even if doc not in mirror (#923)
Juice10 Jul 1, 2022
d5d877e
Inline stylesheets on load (#909)
Juice10 Jul 1, 2022
01612b7
update cssom package to rrweb self-owned package 'rrweb-cssom' (#925)
YunFeng0817 Jul 2, 2022
15cb0b8
Bump parse-url from 6.0.0 to 6.0.2 (#930)
dependabot[bot] Jul 8, 2022
83394c3
refactor: eliminate eslint errors (#920)
YunFeng0817 Jul 10, 2022
2d4dd22
chore(release): publish new version
Yuyz0112 Jul 10, 2022
72874f2
add Eslint action and update travis CI (#931)
YunFeng0817 Jul 10, 2022
f3064c1
Fix href in <use> to not use absolute url (#938)
lele0108 Jul 16, 2022
a014e61
chore(deps): bump terser from 5.7.1 to 5.14.2 (#940)
dependabot[bot] Jul 22, 2022
1fefbd8
chore(deps-dev): bump svelte from 3.40.0 to 3.49.0 (#937)
dependabot[bot] Jul 22, 2022
8ad4325
add special handling for undefined console content (#935)
YunFeng0817 Jul 22, 2022
999f1a5
style: remove all tslint related comments (#934)
YunFeng0817 Jul 22, 2022
f03504a
fix issue #933 (#942)
YunFeng0817 Jul 22, 2022
df9d5bb
fix: eslint action error in a PR from a fork repo (#943)
YunFeng0817 Jul 23, 2022
ba4bcbe
Bump jsdom to latest version as was getting error TS2305: Module '"pa…
eoghanmurray Jul 25, 2022
16089fc
fix console plugin example
Yuyz0112 Jul 25, 2022
b618f09
Remove typings files as these can be regenerated with `npm run typing…
eoghanmurray Jul 26, 2022
aecaefb
chore: remove all typings, add them all to .gitignore file and update…
YunFeng0817 Jul 31, 2022
f1b23dd
fix: canvas data in iframe wasn't applied in the fast-forward mode (#…
YunFeng0817 Jul 31, 2022
cb24aaf
add benchmark for replayer's fast-forward mode (#947)
YunFeng0817 Jul 31, 2022
abc035f
chore(release): publish new version
Yuyz0112 Jul 31, 2022
b2d5689
rrweb: add selection observer (#936)
0jinxing Aug 6, 2022
fd85c79
Handle negative ids in rrdom correctly + extra tests (#927)
Juice10 Aug 6, 2022
a0d5373
fix: errors when fast-forward selection events (#952)
YunFeng0817 Aug 11, 2022
5f59f91
feat: add a destroy function to destroy the whole player (#953)
YunFeng0817 Aug 11, 2022
0554408
Include eslint jest (#959)
Juice10 Aug 19, 2022
1fb1102
add more questions for issue template (#965)
YunFeng0817 Aug 21, 2022
5f3e027
Create CODE_OF_CONDUCT.md (#968)
Juice10 Aug 22, 2022
e0ca915
Create CONTRIBUTING.md (#969)
Juice10 Aug 22, 2022
ac7935e
fix: record canvas by fps when blockClass is RegExp (#966)
QxQstar Aug 27, 2022
5ba933c
isBlocked factors in the selector (#894)
dbseel Aug 30, 2022
f1b5cb2
CI: add a prettier GitHub action to format code automatically (#988)
YunFeng0817 Sep 6, 2022
e7fdf53
fix: can't record shadow root's children except the last one (#956)
YunFeng0817 Sep 7, 2022
6eaec04
fix: Iframe replay fails after the second full snapshot #983 (#984)
QuentinLowe Sep 8, 2022
31890f0
fix error for prettier action (#992)
YunFeng0817 Sep 8, 2022
7be26b0
fix: iframe input hook (#991)
QuentinLowe Sep 9, 2022
49d143f
Ensure positions has length before referencing (#998)
dbseel Sep 15, 2022
a8478f1
[Plugin] Live stream canvas via webrtc (#976)
Juice10 Sep 15, 2022
a9a2559
fix: add mutation lost in slimDOMOptions (#994)
wfk007 Sep 15, 2022
ce6019d
feat: support media playbackRate (#1000)
wfk007 Sep 15, 2022
6007266
fix: reset fns when when stopping record (#962)
wfk007 Sep 17, 2022
96b7466
fix duplicate shadow doms in the recorder (#1002)
YunFeng0817 Sep 17, 2022
bac1d7b
feat: add dataURLOptions parameter control canvas image format and qu…
QxQstar Sep 17, 2022
08ab7ab
re-use live mode config - and improve docs on how to start liveMode (…
Juice10 Sep 17, 2022
c619a59
Fix that `addAction` wouldn't have any effect without a stop and star…
eoghanmurray Sep 22, 2022
58cd787
chore(release): publish new version
Yuyz0112 Sep 22, 2022
a16d506
Add `play` to live-mode.md (#1009)
eoghanmurray Sep 26, 2022
3924aaf
Allow player to play a from-to range (#1007)
Juice10 Sep 26, 2022
6f63cf1
Make maximum scale configurable (#1006)
Juice10 Sep 26, 2022
23e3a73
bugfix: Sort attributes to make `rr_*` attributes handled last (#970)
Juice10 Sep 26, 2022
3809060
feat: add support for recording and replaying adoptedStyleSheets API …
YunFeng0817 Sep 29, 2022
55ebce7
Fix inline link elements bug (#995)
YunFeng0817 Sep 30, 2022
6f44bb7
Call `afterAppend` for mutations and top level elements (#1012)
Juice10 Sep 30, 2022
e86d482
chore(release): publish new version
Yuyz0112 Sep 30, 2022
9de0de2
Add maxScale to rrwebPlayer types and add docs to others (#1014)
Juice10 Oct 4, 2022
20ad416
`prototype` here does not refer to the correct WebGLRenderingContext …
eoghanmurray Oct 5, 2022
87aa3b6
Ignore noisy webgl params (#1016)
eoghanmurray Oct 8, 2022
7edfefe
fix: recording bug in youtube and bitbucket (#1020)
YunFeng0817 Oct 12, 2022
1ec4413
doc: improve contributor experience (#1024)
samber Oct 16, 2022
ae643f4
Fix #972 [Docs]: Add Readme.md to packages/rrweb (#1025)
HurricaHjz Oct 17, 2022
2286c11
Update Player.svelte: fix the bug. (#1028)
MengZihan712 Oct 17, 2022
bdd8940
Implement: Inactive activity indicator on progress bar (#1039)
DexxDing Oct 31, 2022
5012b1e
fix: wrappedEmit is not a function (#1034)
wfk007 Nov 1, 2022
ad9bc3e
Chore: Move most types from rrweb to @rrweb/types package (#1031)
Juice10 Nov 4, 2022
98e71cd
Replace travis ci with github actions (#1043)
Juice10 Nov 4, 2022
1990524
fix: bug when handling shadow doms (#1041)
YunFeng0817 Nov 7, 2022
e08d039
fix CI error (#1045)
YunFeng0817 Nov 7, 2022
75e2280
Add rrweb-player readme (#1050)
Juice10 Nov 12, 2022
9bbc3e0
Fix: Capture css `background-clip: text` with browser prefix (#1047)
Juice10 Nov 12, 2022
fdb7135
Fix: scrolling on elements being is ignored (#1029)
Juice10 Nov 12, 2022
a9fffb3
shadow root use the correct dom in iframe (#1037)
QuentinLowe Nov 13, 2022
2a80949
Cross origin iframe support (#1035)
Juice10 Nov 16, 2022
7bb6862
chore(release): publish new version
Yuyz0112 Nov 16, 2022
59a1e4f
fix @rrweb prefix package access
Yuyz0112 Nov 16, 2022
a220835
Fix: Post message can break cross origin iframe recording (#1053)
Juice10 Nov 16, 2022
7e8dcdb
Fix muted false -> true not being set
lele0108 Dec 2, 2022
b655361
Export `recordOptions` type (#1067)
mydea Jan 6, 2023
36b44e1
fix: Failed to execute insertBefore on Node (#1042)
wfk007 Jan 9, 2023
44e92cb
Handle errors when observing iframes (#1058)
mydea Jan 9, 2023
729b8bf
Fix: Catch iframe manager & fix formatting issues (#1083)
Juice10 Jan 9, 2023
03821d9
harmonize on a single getWindowScroll (#1054)
eoghanmurray Jan 9, 2023
cfac5e7
Chore: Make tests less flakey & upgrade puppeteer to rrweb-snapshot t…
Juice10 Jan 10, 2023
a596a1e
chore(deps): bump qs from 6.5.2 to 6.5.3 (#1072)
dependabot[bot] Jan 10, 2023
6be4437
chore(deps): bump express from 4.17.1 to 4.18.2 (#1076)
dependabot[bot] Jan 10, 2023
9354636
chore(deps): bump decode-uri-component from 0.2.0 to 0.2.2 (#1068)
dependabot[bot] Jan 10, 2023
55cc1b3
chore(deps): bump loader-utils from 1.4.0 to 1.4.2 (#1051)
dependabot[bot] Jan 10, 2023
fe69bd6
fix: module error (#1087)
YunFeng0817 Jan 10, 2023
d08913d
Fix missed adopted style sheets of shadow doms in checkout full snaps…
YunFeng0817 Jan 10, 2023
66abe17
Fix: isBlocked throws on invalid HTML element (#1032)
dbseel Jan 10, 2023
07aa1b2
Fix: shadow dom bugs (#1049)
Juice10 Jan 10, 2023
57a2e14
feat: Guard against missing `window.CSSStyleSheet` (#1088)
mydea Jan 13, 2023
fc82869
Fix cross origin iframe bugs (#1093)
YunFeng0817 Jan 16, 2023
7e002b9
chore(deps): bump http-cache-semantics from 4.1.0 to 4.1.1 (#1108)
dependabot[bot] Feb 6, 2023
a77e302
[console-plugin] Feat: Record `unhandledrejection` event (#1104)
jlalmes Feb 6, 2023
25a4f5a
[fix] Don't trigger Finish event when in liveMode (#1115)
Juice10 Feb 9, 2023
cb15800
fix: Ensure CSS support is checked more robustly (#1106)
mydea Feb 9, 2023
0732618
fix: wrong rootId value in special iframes (#1100)
YunFeng0817 Feb 9, 2023
3caa25e
Don't have requestAnimationFrame looping in background for Live Mode …
eoghanmurray Feb 9, 2023
3a26e36
fix: regression of issue: ShadowHost can't be a string (issue 941) (#…
YunFeng0817 Feb 9, 2023
4ee86fe
improve rrdom robustness (#1091)
YunFeng0817 Feb 9, 2023
07d22e7
enable to customize logger in the replayer (#1111)
YunFeng0817 Feb 9, 2023
0627d4d
add option to record on DOMContentLoaded event (#1109)
YunFeng0817 Feb 9, 2023
174b9ac
fix: mutation Failed to execute 'insertBefore' on 'Node': Only one do…
YunFeng0817 Feb 9, 2023
5a1e5e9
Automate NPM package releases (#1119)
Juice10 Feb 11, 2023
8d209a6
add change log and update readme (#1122)
YunFeng0817 Feb 12, 2023
502d15d
fix: outdated ':hover' styles can't be removed from iframes or shadow…
YunFeng0817 Feb 12, 2023
fdce994
Add friendly changelog message (#1124)
Juice10 Feb 12, 2023
2946f10
Add needed dependency for changeset formatter (#1125)
Juice10 Feb 12, 2023
1385f7a
fix duplicated shadow dom (#1095)
YunFeng0817 Feb 12, 2023
227d43a
refine change logs (#1126)
YunFeng0817 Feb 12, 2023
282c8fa
rrweb extension implementation (#1044)
YunFeng0817 Feb 13, 2023
3cc4323
improve rrdom performance (#1127)
YunFeng0817 Feb 14, 2023
f9affc9
Chore: Bump up all package versions together whenever any one version…
Juice10 Feb 14, 2023
b540c04
fix: Exclude scripts loaded with `rel=modulepreload` from snapshots (…
billyvg Feb 14, 2023
39f8c24
Version Packages (alpha) (#1123)
github-actions[bot] Feb 14, 2023
28111c1
Fix broken changeset release action (#1134)
Juice10 Feb 14, 2023
033d2d1
some minor changes for releasing the extension and revert failed publ…
YunFeng0817 Feb 14, 2023
06031a6
Version Packages (alpha) (#1135)
github-actions[bot] Feb 14, 2023
f6f07e9
Fix relative path detection in stylesheet URLs (#1130)
Equlnox Feb 15, 2023
aaabdbd
fix: Recursive logging bug with console recording (#1136)
benjackwhite Feb 16, 2023
3416c3a
fix: isCheckout is not included in fullsnapshot event (#1141)
YunFeng0817 Feb 17, 2023
be54981
chore: web-extension vite.config.ts needs these changes to work for n…
neilhan Feb 19, 2023
c28ef5f
Replay fix for Firefox — add <head> and <body> separately (#1133)
eoghanmurray Feb 22, 2023
e65465e
fix the statement which is getting changed by Microbundle (#1156)
Code-Crash Feb 27, 2023
8e47ca1
fix: Explicitly handle `null` attribute values (#1157)
mydea Feb 27, 2023
5e6c132
Set userTriggered to false on Input attribute modifications (#1159)
eoghanmurray Mar 3, 2023
eac9b18
feat: Ignore `autoplay` attribute on video/audio elements (#1152)
mydea Mar 3, 2023
d82c5ed
Update CONTRIBUTING.md (#1165)
eoghanmurray Mar 4, 2023
f27e545
Fix: Switch to real dom before rebuilding fullsnapshot (#1139)
YunFeng0817 Mar 8, 2023
d292167
Add tsdoc/jsdoc deprecated notice to Mirror (#1168)
Juice10 Mar 8, 2023
4948c30
Fix changesets patch level of PR #1159 (#1169)
Juice10 Mar 8, 2023
1f8e5d5
Version Packages (alpha) (#1138)
github-actions[bot] Mar 8, 2023
e7f0c80
fix: inline images onload (#1174)
wfk007 Mar 13, 2023
4cb4d0e
improve: some websites rebuild imcomplete (#1163)
zhaobosky Mar 13, 2023
5982c89
fix: Cannot set property attributeName of #<MutationRecord> which has…
wfk007 Mar 15, 2023
e0f862b
fix: worker_thread warning (#1179)
wfk007 Mar 18, 2023
a82a3b4
Extend the suppression of warnings to take into account anscestors (#…
eoghanmurray Mar 18, 2023
d2582e9
feat: Ensure password inputs are masked when switching type (#1170)
mydea Mar 20, 2023
a225d8e
feat: Allow to pass `errorHandler` as record option (#1107)
mydea Mar 22, 2023
267e990
Fix: processed-node-manager is created even in the environment that d…
YunFeng0817 Mar 24, 2023
0138ab8
Update FUNDING.yml
Yuyz0112 Mar 25, 2023
1e6f71b
Fix: Trigger mouse movement & hover with mouse up/down in sync mode (…
Juice10 Mar 28, 2023
f1f5865
move rrvideo to monorepo (#1181)
YunFeng0817 Mar 28, 2023
1b2855b
Version Packages (alpha) (#1175)
github-actions[bot] Mar 28, 2023
351c555
Record pointerType on clicks - could be useful for displaying e.g. a …
eoghanmurray Feb 13, 2023
73ee29f
Apply formatting changes
eoghanmurray Mar 30, 2023
979d2b1
Create little-suits-leave.md
eoghanmurray Mar 30, 2023
2114dc4
Apply formatting changes
eoghanmurray Mar 30, 2023
d7beb11
fix: doc fix canvas-webrtc link (#1193)
xujiujiu Apr 2, 2023
3a6de4b
Make the pointerType into an Enum to be consistent with other values …
eoghanmurray Apr 5, 2023
be85644
Apply formatting changes
eoghanmurray Apr 5, 2023
d0fdc0f
improve: add try catch to snapshot.ts 's masking text function (#1148)
YunFeng0817 Apr 7, 2023
aa79db7
fix: Fix input.type check (#1184)
mydea Apr 7, 2023
b5e30cf
fix: Set finished=false in goto instead of handleProgressClick (#1198)
charliegracie Apr 8, 2023
41cc822
Merge pull request #1129 from eoghanmurray/pointerType
eoghanmurray Apr 12, 2023
b007980
Fixup type errors
eoghanmurray Apr 12, 2023
0228137
The type system was complaining about the remote possibility that `e`…
eoghanmurray Apr 12, 2023
777ab9a
`pointerType` shows up in clicks in these tests on my machine; `0=Poi…
eoghanmurray Apr 12, 2023
3ce6903
Add a baseline test for clicking links
eoghanmurray Aug 9, 2021
961abec
Get puppeteer to produce a touch event - this also uncovered an error…
eoghanmurray Apr 12, 2023
004d29b
eslint was giving an error here
eoghanmurray Apr 12, 2023
4939c00
Create fair-dragons-greet.md
Juice10 Apr 12, 2023
f884711
Merge pull request #1201 from eoghanmurray/pointerTypeFixups
eoghanmurray Apr 13, 2023
94d0653
fix: change default value of input type from null to text (#1200)
re-fort Apr 14, 2023
944615d
Add gold sponsors (#1207)
Juice10 Apr 14, 2023
bc84246
feat: Added support maskInputFn with HTMLElement (#1188)
benjackwhite Apr 15, 2023
c550cfa
Reduce verbosity/redundancy of new pointerType attribute (#1206)
eoghanmurray Apr 16, 2023
db66eb4
Version Packages (alpha) (#1199)
github-actions[bot] Apr 16, 2023
751d3c7
fix: all tiers of sponsors are displayed under the 'gold sponsor' lev…
YunFeng0817 Apr 24, 2023
1d169d5
Add highlight to "who's using rrweb" (#1215)
Juice10 Apr 29, 2023
ebcbe8b
perf: record processMutation (#1214)
wfk007 May 1, 2023
23d0138
rrvideo: improve the video quality and add a progress bar for the CLI…
YunFeng0817 May 1, 2023
0fedb8e
Docs: scale sponsors by donation size (#1217)
Juice10 May 1, 2023
4dcdcf7
fix: Rrror parser throw (#1225)
benjackwhite May 15, 2023
a1ec9a2
perf: optimize performance of the DoubleLinkedList get (#1220)
wfk007 May 22, 2023
aca67a0
docs: add analyzee to readme (#1227)
AntonioStipic May 22, 2023
a6ce718
Avoid triggering a CSP (content security policy) error (#846)
eoghanmurray May 22, 2023
a606109
fix turbo dev command errors (#1229)
YunFeng0817 Jun 2, 2023
b798f2d
Fix rrdom bugs (#1222)
YunFeng0817 Jun 2, 2023
d7c72bf
fix: Ensure attributes are lowercased when checking (#1183)
mydea Jun 2, 2023
325a9f0
Update test commands (#1205)
eoghanmurray Jun 2, 2023
490b3e2
Guard against redefinition of Date.now (#1196)
eoghanmurray Jun 2, 2023
a01a12e
Fix types in rrwebPlayer (#1247)
Juice10 Jun 30, 2023
46df5cd
Version Packages (alpha) (#1216)
github-actions[bot] Jun 30, 2023
40085d3
feat: Pass parent element or node to `maskTextFn`
billyvg Jul 17, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
isBlocked factors in the selector (rrweb-io#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 <[email protected]>
  • Loading branch information
dbseel and Filip authored Aug 30, 2022
commit 5ba933cce3d9e2acd5e3e82c2936aeecc61958bb
1 change: 1 addition & 0 deletions guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ The parameter of `rrweb.record` accepts the following options.
| blockClass | 'rr-block' | Use a string or RegExp to configure which elements should be blocked, refer to the [privacy](#privacy) chapter |
| blockSelector | null | Use a string to configure which selector should be blocked, refer to the [privacy](#privacy) chapter |
| ignoreClass | 'rr-ignore' | Use a string or RegExp to configure which elements should be ignored, refer to the [privacy](#privacy) chapter |
| ignoreCSSAttributes | null | array of CSS attributes that should be ignored |
| maskTextClass | 'rr-mask' | Use a string or RegExp to configure which elements should be masked, refer to the [privacy](#privacy) chapter |
| maskTextSelector | null | Use a string to configure which selector should be masked, refer to the [privacy](#privacy) chapter |
| maskAllInputs | false | mask all input content as \* |
Expand Down
1 change: 1 addition & 0 deletions guide.zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ setInterval(save, 10 * 1000);
| blockClass | 'rr-block' | 字符串或正则表达式,可用于自定义屏蔽元素的类名,详见[“隐私”](#隐私)章节 |
| blockSelector | null | 所有 element.matches(blockSelector)为 true 的元素都不会被录制,回放时取而代之的是一个同等宽高的占位元素 |
| ignoreClass | 'rr-ignore' | 字符串或正则表达式,可用于自定义忽略元素的类名,详见[“隐私”](#隐私)章节 |
| ignoreCSSAttributes | null | 应该被忽略的 CSS 属性数组 |
| maskTextClass | 'rr-mask' | 字符串或正则表达式,可用于自定义忽略元素 text 内容的类名,详见[“隐私”](#隐私)章节 |
| maskTextSelector | null | 所有 element.matches(maskTextSelector)为 true 的元素及其子元素的 text 内容将会被屏蔽 |
| maskAllInputs | false | 将所有输入内容记录为 \* |
Expand Down
4 changes: 4 additions & 0 deletions packages/rrweb/src/record/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ function record<T = eventWithTime>(
inlineImages = false,
plugins,
keepIframeSrcFn = () => false,
ignoreCSSAttributes = new Set([]),
} = options;

// runtime checks for user options
if (!emit) {
throw new Error('emit function is required');
Expand Down Expand Up @@ -226,6 +228,7 @@ function record<T = eventWithTime>(
mutationCb: wrappedCanvasMutationEmit,
win: window,
blockClass,
blockSelector,
mirror,
sampling: sampling.canvas,
});
Expand Down Expand Up @@ -464,6 +467,7 @@ function record<T = eventWithTime>(
stylesheetManager,
shadowDomManager,
canvasManager,
ignoreCSSAttributes,
plugins:
plugins
?.filter((p) => p.observer)
Expand Down
12 changes: 6 additions & 6 deletions packages/rrweb/src/record/mutation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ export default class MutationBuffer {
rootShadowHost =
(rootShadowHost?.getRootNode?.() as ShadowRoot | undefined)?.host ||
null;
// ensure shadowHost is a Node, or doc.contains will throw an error
// ensure contains is passed a Node, or it will throw an error
const notInDoc =
!this.doc.contains(n) &&
(!rootShadowHost || !this.doc.contains(rootShadowHost));
Expand Down Expand Up @@ -446,7 +446,7 @@ export default class MutationBuffer {
case 'characterData': {
const value = m.target.textContent;
if (
!isBlocked(m.target, this.blockClass, false) &&
!isBlocked(m.target, this.blockClass, this.blockSelector, false) &&
value !== m.oldValue
) {
this.texts.push({
Expand Down Expand Up @@ -478,7 +478,7 @@ export default class MutationBuffer {
});
}
if (
isBlocked(m.target, this.blockClass, false) ||
isBlocked(m.target, this.blockClass, this.blockSelector, false) ||
value === m.oldValue
) {
return;
Expand Down Expand Up @@ -554,7 +554,7 @@ export default class MutationBuffer {
/**
* Parent is blocked, ignore all child mutations
*/
if (isBlocked(m.target, this.blockClass, true)) return;
if (isBlocked(m.target, this.blockClass, this.blockSelector, true)) return;

m.addedNodes.forEach((n) => this.genAdds(n, m.target));
m.removedNodes.forEach((n) => {
Expand All @@ -563,7 +563,7 @@ export default class MutationBuffer {
? this.mirror.getId(m.target.host)
: this.mirror.getId(m.target);
if (
isBlocked(m.target, this.blockClass, false) ||
isBlocked(m.target, this.blockClass, this.blockSelector, false) ||
isIgnored(n, this.mirror) ||
!isSerialized(n, this.mirror)
) {
Expand Down Expand Up @@ -635,7 +635,7 @@ export default class MutationBuffer {

// if this node is blocked `serializeNode` will turn it into a placeholder element
// but we have to remove it's children otherwise they will be added as placeholders too
if (!isBlocked(n, this.blockClass, false))
if (!isBlocked(n, this.blockClass, this.blockSelector, false))
n.childNodes.forEach((childN) => this.genAdds(childN));
};
}
Expand Down
30 changes: 21 additions & 9 deletions packages/rrweb/src/record/observer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ function initMouseInteractionObserver({
doc,
mirror,
blockClass,
blockSelector,
sampling,
}: observerParam): listenerHandler {
if (sampling.mouseInteraction === false) {
Expand All @@ -227,7 +228,7 @@ function initMouseInteractionObserver({
const getHandler = (eventKey: keyof typeof MouseInteractions) => {
return (event: MouseEvent | TouchEvent) => {
const target = getEventTarget(event) as Node;
if (isBlocked(target, blockClass, true)) {
if (isBlocked(target, blockClass, blockSelector, true)) {
return;
}
const e = isTouchEvent(event) ? event.changedTouches[0] : event;
Expand Down Expand Up @@ -266,14 +267,15 @@ export function initScrollObserver({
doc,
mirror,
blockClass,
blockSelector,
sampling,
}: Pick<
observerParam,
'scrollCb' | 'doc' | 'mirror' | 'blockClass' | 'sampling'
'scrollCb' | 'doc' | 'mirror' | 'blockClass' | 'blockSelector' | 'sampling'
>): listenerHandler {
const updatePosition = throttle<UIEvent>((evt) => {
const target = getEventTarget(evt);
if (!target || isBlocked(target as Node, blockClass, true)) {
if (!target || isBlocked(target as Node, blockClass, blockSelector, true)) {
return;
}
const id = mirror.getId(target as Node);
Expand Down Expand Up @@ -331,6 +333,7 @@ function initInputObserver({
doc,
mirror,
blockClass,
blockSelector,
ignoreClass,
maskInputOptions,
maskInputFn,
Expand All @@ -350,7 +353,7 @@ function initInputObserver({
!target ||
!(target as Element).tagName ||
INPUT_TAGS.indexOf((target as Element).tagName) < 0 ||
isBlocked(target as Node, blockClass, true)
isBlocked(target as Node, blockClass, blockSelector, true)
) {
return;
}
Expand Down Expand Up @@ -613,7 +616,7 @@ function initStyleSheetObserver(
}

function initStyleDeclarationObserver(
{ styleDeclarationCb, mirror }: observerParam,
{ styleDeclarationCb, mirror, ignoreCSSAttributes }: observerParam,
{ win }: { win: IWindow },
): listenerHandler {
// eslint-disable-next-line @typescript-eslint/unbound-method
Expand All @@ -624,6 +627,10 @@ function initStyleDeclarationObserver(
value: string,
priority: string,
) {
// ignore this mutation if we do not care about this css attribute
if (ignoreCSSAttributes.has(property)) {
return setProperty.apply(this, [property, value, priority]);
}
const id = mirror.getId(this.parentRule?.parentStyleSheet?.ownerNode);
if (id !== -1) {
styleDeclarationCb({
Expand All @@ -645,6 +652,10 @@ function initStyleDeclarationObserver(
this: CSSStyleDeclaration,
property: string,
) {
// ignore this mutation if we do not care about this css attribute
if (ignoreCSSAttributes.has(property)) {
return removeProperty.apply(this, [property]);
}
const id = mirror.getId(this.parentRule?.parentStyleSheet?.ownerNode);
if (id !== -1) {
styleDeclarationCb({
Expand All @@ -667,13 +678,14 @@ function initStyleDeclarationObserver(
function initMediaInteractionObserver({
mediaInteractionCb,
blockClass,
blockSelector,
mirror,
sampling,
}: observerParam): listenerHandler {
const handler = (type: MediaInteractions) =>
throttle((event: Event) => {
const target = getEventTarget(event);
if (!target || isBlocked(target as Node, blockClass, true)) {
if (!target || isBlocked(target as Node, blockClass, blockSelector, true)) {
return;
}
const { currentTime, volume, muted } = target as HTMLMediaElement;
Expand Down Expand Up @@ -755,7 +767,7 @@ function initFontObserver({ fontCb, doc }: observerParam): listenerHandler {
}

function initSelectionObserver(param: observerParam): listenerHandler {
const { doc, mirror, blockClass, selectionCb } = param;
const { doc, mirror, blockClass, blockSelector, selectionCb } = param;
let collapsed = true;

const updateSelection = () => {
Expand All @@ -774,8 +786,8 @@ function initSelectionObserver(param: observerParam): listenerHandler {
const { startContainer, startOffset, endContainer, endOffset } = range;

const blocked =
isBlocked(startContainer, blockClass, true) ||
isBlocked(endContainer, blockClass, true);
isBlocked(startContainer, blockClass, blockSelector, true) ||
isBlocked(endContainer, blockClass, blockSelector, true);

if (blocked) continue;

Expand Down
3 changes: 2 additions & 1 deletion packages/rrweb/src/record/observers/canvas/2d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export default function initCanvas2DMutationObserver(
cb: canvasManagerMutationCallback,
win: IWindow,
blockClass: blockClass,
blockSelector: string | null,
mirror: Mirror,
): listenerHandler {
const handlers: listenerHandler[] = [];
Expand Down Expand Up @@ -41,7 +42,7 @@ export default function initCanvas2DMutationObserver(
this: CanvasRenderingContext2D,
...args: Array<unknown>
) {
if (!isBlocked(this.canvas, blockClass, true)) {
if (!isBlocked(this.canvas, blockClass, blockSelector, true)) {
// Using setTimeout as toDataURL can be heavy
// and we'd rather not block the main thread
setTimeout(() => {
Expand Down
17 changes: 11 additions & 6 deletions packages/rrweb/src/record/observers/canvas/canvas-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,18 @@ export class CanvasManager {
mutationCb: canvasMutationCallback;
win: IWindow;
blockClass: blockClass;
blockSelector: string | null,
mirror: Mirror;
sampling?: 'all' | number;
}) {
const { sampling = 'all', win, blockClass, recordCanvas } = options;
const { sampling = 'all', win, blockClass, blockSelector, recordCanvas } = options;
this.mutationCb = options.mutationCb;
this.mirror = options.mirror;

if (recordCanvas && sampling === 'all')
this.initCanvasMutationObserver(win, blockClass);
this.initCanvasMutationObserver(win, blockClass, blockSelector);
if (recordCanvas && typeof sampling === 'number')
this.initCanvasFPSObserver(sampling, win, blockClass);
this.initCanvasFPSObserver(sampling, win, blockClass, blockSelector);
}

private processMutation: canvasManagerMutationCallback = (
Expand All @@ -94,8 +95,9 @@ export class CanvasManager {
fps: number,
win: IWindow,
blockClass: blockClass,
blockSelector: string | null,
) {
const canvasContextReset = initCanvasContextObserver(win, blockClass);
const canvasContextReset = initCanvasContextObserver(win, blockClass, blockSelector);
const snapshotInProgressMap: Map<number, boolean> = new Map();
const worker = new ImageBitmapDataURLWorker() as ImageBitmapDataURLRequestWorker;
worker.onmessage = (e) => {
Expand Down Expand Up @@ -141,7 +143,7 @@ export class CanvasManager {
const getCanvas = (): HTMLCanvasElement[] => {
const matchedCanvas: HTMLCanvasElement[] = [];
win.document.querySelectorAll('canvas').forEach(canvas => {
if (!isBlocked(canvas, blockClass, true)) {
if (!isBlocked(canvas, blockClass, blockSelector, true)) {
matchedCanvas.push(canvas);
}
})
Expand Down Expand Up @@ -208,22 +210,25 @@ export class CanvasManager {
private initCanvasMutationObserver(
win: IWindow,
blockClass: blockClass,
blockSelector: string | null,
): void {
this.startRAFTimestamping();
this.startPendingCanvasMutationFlusher();

const canvasContextReset = initCanvasContextObserver(win, blockClass);
const canvasContextReset = initCanvasContextObserver(win, blockClass, blockSelector);
const canvas2DReset = initCanvas2DMutationObserver(
this.processMutation.bind(this),
win,
blockClass,
blockSelector,
this.mirror,
);

const canvasWebGL1and2Reset = initCanvasWebGLMutationObserver(
this.processMutation.bind(this),
win,
blockClass,
blockSelector,
this.mirror,
);

Expand Down
3 changes: 2 additions & 1 deletion packages/rrweb/src/record/observers/canvas/canvas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { isBlocked, patch } from '../../../utils';
export default function initCanvasContextObserver(
win: IWindow,
blockClass: blockClass,
blockSelector: string | null,
): listenerHandler {
const handlers: listenerHandler[] = [];
try {
Expand All @@ -23,7 +24,7 @@ export default function initCanvasContextObserver(
contextType: string,
...args: Array<unknown>
) {
if (!isBlocked(this, blockClass, true)) {
if (!isBlocked(this, blockClass, blockSelector, true)) {
if (!('__context' in this)) this.__context = contextType;
}
return original.apply(this, [contextType, ...args]);
Expand Down
6 changes: 5 additions & 1 deletion packages/rrweb/src/record/observers/canvas/webgl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ function patchGLPrototype(
type: CanvasContext,
cb: canvasManagerMutationCallback,
blockClass: blockClass,
blockSelector: string | null,
mirror: Mirror,
win: IWindow,
): listenerHandler[] {
Expand All @@ -36,7 +37,7 @@ function patchGLPrototype(
return function (this: typeof prototype, ...args: Array<unknown>) {
const result = original.apply(this, args);
saveWebGLVar(result, win, prototype);
if (!isBlocked(this.canvas, blockClass, true)) {
if (!isBlocked(this.canvas, blockClass, blockSelector, true)) {
const recordArgs = serializeArgs([...args], win, prototype);
const mutation: canvasMutationWithType = {
type,
Expand Down Expand Up @@ -76,6 +77,7 @@ export default function initCanvasWebGLMutationObserver(
cb: canvasManagerMutationCallback,
win: IWindow,
blockClass: blockClass,
blockSelector: string | null,
mirror: Mirror,
): listenerHandler {
const handlers: listenerHandler[] = [];
Expand All @@ -86,6 +88,7 @@ export default function initCanvasWebGLMutationObserver(
CanvasContext.WebGL,
cb,
blockClass,
blockSelector,
mirror,
win,
),
Expand All @@ -98,6 +101,7 @@ export default function initCanvasWebGLMutationObserver(
CanvasContext.WebGL2,
cb,
blockClass,
blockSelector,
mirror,
win,
),
Expand Down
2 changes: 1 addition & 1 deletion packages/rrweb/src/record/shadow-dom-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export class ShadowDomManager {
const manager = this;
this.restorePatches.push(
patch(
HTMLElement.prototype,
Element.prototype,
'attachShadow',
function (original: (init: ShadowRootInit) => ShadowRoot) {
return function (this: HTMLElement, option: ShadowRootInit) {
Expand Down
2 changes: 2 additions & 0 deletions packages/rrweb/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ export type recordOptions<T> = {
maskInputFn?: MaskInputFn;
maskTextFn?: MaskTextFn;
slimDOMOptions?: SlimDOMOptions | 'all' | true;
ignoreCSSAttributes?:Set<string>;
inlineStylesheet?: boolean;
hooks?: hooksParam;
packFn?: PackFn;
Expand Down Expand Up @@ -294,6 +295,7 @@ export type observerParam = {
stylesheetManager: StylesheetManager;
shadowDomManager: ShadowDomManager;
canvasManager: CanvasManager;
ignoreCSSAttributes:Set<string>;
plugins: Array<{
observer: (
cb: (...arg: Array<unknown>) => void,
Expand Down
Loading