Commit Graph

1197 Commits

Author SHA1 Message Date
Paul D'Ambra
77e12e4f54 fix: console logger can serialize bigint values (#1403)
* fix: console logger can serialize bigint values

* teach test jsdom is present

* add a changeset
2026-04-01 12:00:00 +08:00
David Newell
6510e32456 chore: export canvasMutation (#1383)
* chore: export canvasMutation

* add changeset
2026-04-01 12:00:00 +08:00
Justin Halsall
04a5ce9ad8 Docs: Add rrweb presentation + open to consulting (#1388)
* Add rrweb presentation

Add Justin Halsall open to rrweb consulting

* Create few-rockets-travel.md

* Update README.md

* Update README.md

* Fix alignment
2026-04-01 12:00:00 +08:00
Buleandra Cristian
30fda9d726 Add UXWizz to Readme (#1371)
* Add UXWizz to Readme (CN)

* Add UXWizz to Readme

* Create hip-worms-relax.md

---------

Co-authored-by: Justin Halsall <Juice10@users.noreply.github.com>
2026-04-01 12:00:00 +08:00
Justin Halsall
43bce2b6e0 [chore] [ci] Update Node version to LTS (#1365)
* Update Node version to LTS

* Create silver-windows-float.md
2026-04-01 12:00:00 +08:00
Justin Halsall
e763ada2c1 [chore] Update changesets (#1362) 2026-04-01 12:00:00 +08:00
huangkairan
2db6264887 perf(web-extension): conditional check (#1360)
Co-authored-by: Yun Feng <yun.feng0817@gmail.com>
2026-04-01 12:00:00 +08:00
Paul D'Ambra
f91d22bf31 chore: update linters (#1355)
Co-authored-by: Justin Halsall <Juice10@users.noreply.github.com>
2026-04-01 12:00:00 +08:00
Eoghan Murray
a8d93986f4 Fix serialization and mutation of <textarea> elements (#1351)
* Fix serialization and mutation of <textarea> elements taking account the duality that the value can be set in either the child node, or in the value _parameter_ (not attribute)

* Backwards compatibility: Bug fix and regression test for #112
 - this is to fix up 'historical' recordings, as duplicate textarea content should no longer be being created at record time
 - new test shows what the snapshot generated by previous versions of rrweb used to look like, hence 'bad'
 - original 0efe23f04a fix either didn't work or no longer works due to childNodes being appended subsequent to this part of the code
 - during review, we also verified that the `_cssText` case should still be handled okay, as there's currently no scenario where csstext is present with css child nodes of a <style>

* Masking: Fix that textarea values were being missed by the masking system if the value was recorded as a child node
 - I didn't notice that form.html was used in other tests, so lucky that I noticed that those tests also should have the 'pre value' masked out

* Simplify by always storing the textarea value in the `.value` attribute (from it's DOM property) and not as a childNode. It should still be rebuilt as a childNode rather than a property
---------

Authored-by: eoghanmurray <eoghan@getthere.ie>
2026-04-01 12:00:00 +08:00
Eoghan Murray
d1d0c7f366 Masking: Avoid the repeated calls to closest when recursing through the DOM (#1349)
* masking performance: avoid the repeated calls to `closest` when recursing through the DOM
 - needsMask===true means that an ancestor has tested positively for masking, and so this node and all descendents should be masked
 - needsMask===false means that no ancestors have tested positively for masking, we should check each node encountered
 - needsMask===undefined means that we don't know whether ancestors are masked or not (e.g. after a mutation) and should look up the tree
* Add tests including an explicit characterData mutation tests 
* Further performance improvement: avoid calls to `el.matches` when on a leaf node, e.g. a `<br/>`
---------

Authored-by: eoghanmurray <eoghan@getthere.ie>
Based on initial PR #1338 by Alexey Babik <alexey.babik@noibu.com>
2026-04-01 12:00:00 +08:00
Yun Feng
4157f28e7b Feat: Add support for replaying :defined pseudo-class of custom elements (#1155)
* Feat: Add support for replaying :defined pseudo-class of custom elements

* add isCustom flag to serialized elements

Applying Justin's review suggestion

* fix code lint error

* add custom element event

* fix: tests (#1348)

* Update packages/rrweb/src/record/observer.ts

* Update packages/rrweb/src/record/observer.ts

---------

Co-authored-by: Nafees Nehar <nafees87n@gmail.com>
Co-authored-by: Justin Halsall <Juice10@users.noreply.github.com>
2026-04-01 12:00:00 +08:00
Eoghan Murray
1647bc3875 Md create html document (#1321)
* only call createHTMLDocument where it is needed

* Perf: create the mutation document once as a 'singleton' as it can be reused

---------

Co-authored-by: Michael Dellanoce <mdellanoce@pendo.io>
2026-04-01 12:00:00 +08:00
Billy Vong
2de4c0d326 fix(web-extension): Fix types in vite config (#1333) 2026-04-01 12:00:00 +08:00
Lukas Boehler
910fa46d78 Added Gleap.io to "Who's using rrweb?" (#1332)
Co-authored-by: Justin Halsall <Juice10@users.noreply.github.com>
2026-04-01 12:00:00 +08:00
huangkairan
228a72e1e8 fix(web-extension): beforeunload logic (#1330) 2026-04-01 12:00:00 +08:00
Michael Dellanoce
a8dcca54d8 perf(rrweb): attribute mutation optimization (#1343) 2026-04-01 12:00:00 +08:00
Francesco Novy
6dafa924d2 ref: Avoid unnecessary cloning of objects or arrays (#1340) 2026-04-01 12:00:00 +08:00
Justin Halsall
637264c225 Fix linting issues (#1347)
* Fix linting issues

* Apply formatting changes
2026-04-01 12:00:00 +08:00
蟹老板
532fc89a61 Pref: export eventWithTime (#1324)
*  export eventWithTime for consumption in typescript code
2026-04-01 12:00:00 +08:00
huangkairan
f57028fa28 🐞 fix(web-extension): typo (#1307)
Co-authored-by: Yun Feng <yun.feng0817@gmail.com>
2026-04-01 12:00:00 +08:00
Francesco Novy
cd577d4d1d fix: Fix checking for patchTarget in initAdoptedStyleSheetObserver (#1327) 2026-04-01 12:00:00 +08:00
Ben White
db334d2405 Extended text masking function to include relevant HTMLElement (#1310)
* Extends maskTextFn to pass the HTMLElement to the deciding function

---------

Authored-by: benjackwhite <benjackwhite@users.noreply.github.com>
Co-authored-by: Justin Halsall <Juice10@users.noreply.github.com>
Co-authored-by: Eoghan Murray <eoghan@getthere.ie>
2026-04-01 12:00:00 +08:00
Eoghan Murray
5e47fac5d0 Add config option to turn off all snapshotting and related observers (#1311)
* Add config option to turn off all snapshotting and related observers

 - allows RRWEB to be used for click/movement tracking alone, e.g. for a heatmaps use case
 - could also be used if there was a separate process for recording the DOM (in which case a 3rd party library like https://github.com/antonmedv/finder could be added to record targets instead of the mirror)
---------

Authored-by: eoghanmurray <eoghanmurray@users.noreply.github.com>
Co-authored-by: Justin Halsall <Juice10@users.noreply.github.com>
2026-04-01 12:00:00 +08:00
Kento Moriwaki
d22225bd1b Enable preserveSource (#1309) 2026-04-01 12:00:00 +08:00
Eoghan Murray
705a03a84e Perf: Avoid creation of intermediary array when iterating over style rules (#1272)
* Perf: Avoid creation of intermediary array when iterating over stylesheet rules by using the second `mapFn` argument of Array.from

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/from

Performance analysis by: JonasBA <jonas@badalic.com>
Authored-by: Eoghan Murray <eoghan@getthere.ie>
2026-04-01 12:00:00 +08:00
Eoghan Murray
816d65ec3f Perf: don't run the regex replace unless the selectorText contains a colon (#1280)
* Perf: don't run the regex replace unless the selectorText contains a colon (rules generally contain colons)

* Need to check type before querying selectorText property - also good as it means we only try to fix colons at the leaf level
---------

Authored-by: eoghan murray <eoghan@getthere.ie>
2026-04-01 12:00:00 +08:00
Justin Halsall
515274f22b Make sure CI doesn't trigger updates to yarn.lock files (#1288)
* Make sure CI doesn't trigger updates to yarn.lock files

* Apply formatting changes

* Create cuddly-readers-warn.md

* Apply formatting changes
2026-04-01 12:00:00 +08:00
github-actions[bot]
8f03b3ae2a Version Packages (alpha) (#1286)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2026-04-01 12:00:00 +08:00
Justin Halsall
a6812827e0 Add workaround for Chrome/Edge css import escaping bug (#1287)
* Upgrade to typescript 4.9.5

* Apply formatting changes

* Add workaround for chrome incorrect escaping bug

More info: https://bugs.chromium.org/p/chromium/issues/detail?id=1472259

* Apply formatting changes

* Create itchy-dryers-double.md

* Create rich-jars-remember.md

* Apply formatting changes

* Update packages/rrweb-snapshot/src/css.ts

* Apply formatting changes

* Update packages/rrweb-snapshot/test/__snapshots__/integration.test.ts.snap

* Apply formatting changes

* Update snapshot

* Apply formatting changes

* Rename and refactor fixBrowserCompatibilityIssuesInCSSImports, getCssRulesString and getCssRuleString based on @eoghanmurray feedback

* Apply formatting changes

* Apply formatting changes
2026-04-01 12:00:00 +08:00
Eoghan Murray
6de70cbf21 Extend to run fixBrowserCompatibilityIssuesInCSS over inline stylesheets (#1279)
* Extend to run fixBrowserCompatibilityIssuesInCSS over styles in inline style sheets

* Apply formatting changes

---------

Co-authored-by: eoghanmurray <eoghanmurray@users.noreply.github.com>
2026-04-01 12:00:00 +08:00
Yun Feng
26084f9bf7 doc: update sponsor list and company list (#1282)
* doc: update sponsor list and company list

* Apply formatting changes

* Apply formatting changes

* Create khaki-dots-bathe.md

* Apply formatting changes

* Apply formatting changes

---------

Co-authored-by: YunFeng0817 <YunFeng0817@users.noreply.github.com>
Co-authored-by: Justin Halsall <Juice10@users.noreply.github.com>
2026-04-01 12:00:00 +08:00
Sahil Gupta
1abac5c6bf Added requestly in who's using rrweb section (#1278) 2026-04-01 12:00:00 +08:00
github-actions[bot]
d5057c6268 Version Packages (alpha) (#1252)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2026-04-01 12:00:00 +08:00
Justin Halsall
7d1a278688 Canvas recording: Preserve drawing buffer (#1273)
* Upgrade jest to 29 and puppeteer to 16 in rrweb

* Apply formatting changes

* Upgrade rrweb's puppeteer to v20

* Apply formatting changes

* Canvas: Reduce flickering and capturing of empty canvas elements

Turn on `preserveDrawingBuffer` by default for canvas FPS recording.
Has some negative performance implications, but really helps when capturing canvas.

* Apply formatting changes

* Include all test image snapshots in ci

* Apply formatting changes

* Allow more flexibility when capturing hover

* Apply formatting changes

* Create tiny-chairs-build.md

* Apply formatting changes

* Update hover.test.ts

* Apply formatting changes

* Document snapshotFormat jest config

* Freeze `yarn.lock` in ci for reproducible dependencies

* Apply formatting changes

* Apply formatting changes

* Revert to old style of puppeteer evaluation script notation

* Apply formatting changes

* Make test less flaky

* Apply formatting changes

* Apply formatting changes

* Make tests less flaky

* Apply formatting changes

* Make test more robust

* Apply formatting changes

* Apply formatting changes

* Add debugging code for test

* Apply formatting changes

* Also test not ignored input

* Apply formatting changes

* Apply formatting changes

* Apply formatting changes

* escape ignoreSelector

* Apply formatting changes

* Apply formatting changes
2026-04-01 12:00:00 +08:00
Billy Vong
d4ce14af98 feat: Add ignoreSelector option (#1262)
* feat: Add `ignoreSelector` option

Similar to `ignoreClass`, but accepts a CSS selector so that you can use any CSS selector.

* Apply formatting changes

* Create clean-shrimps-lay.md

* Apply formatting changes
2026-04-01 12:00:00 +08:00
Eoghan Murray
b4288791bd Mutation (attribute & text) duplicate info elimination (#1269)
* Add a test which demonstrates how no mutations are generated when an element is created & destroyed in the same 'cycle' (a cylce here being enforced by freezePage)

* Test demonstrating current behaviour I'm about to modify; the data-test="x" attribute is present twice in the mutation, as is the textContent value of 'y'

* Attribute or text modifications on just-added nodes are redundant as demonstrated in test case

* Some correct test changes from other tests; I've manually inspected each of these mutation removals and confirmed that the attribute values are already present in the newly added nodes elsewhere in the same mutation

* Improve reliability of test case as per Justin's advice
2026-04-01 12:00:00 +08:00
Eoghan Murray
d778e87891 Compact style mutation fixes and improvements (#1268)
* Don't use the CSSOM when there's `var()` present as it fails badly https://github.com/rrweb-io/rrweb/pull/1246

* As the CSS Object Model expands out shorthand properties, do a check on the string length before choosing which format to go for

 - this approach allows 'var()' in a styleOMValue as it's only a problem when combined with a shorthand property
 - before this change background:black; was getting expaned to 10 OM properties as follows:

'style': {
    'background-color': 'black',
    'background-image': false,
    'background-position-x': false,
    'background-position-y': false,
    'background-size': false,
    'background-repeat-x': false,
    'background-repeat-y': false,
    'background-attachment': false,
    'background-origin': false,
    'background-clip': false
}

* Updates to remainder of tests based on refined compact style mutations

* Apply suggestions from code review by: Justin Halsall <Juice10@users.noreply.github.com>

---------

Authored-by: eoghanmurray <eoghan@getthere.ie>
2026-04-01 12:00:00 +08:00
Francesco Novy
3cf1b8b450 fix: Fix CSS rules captured in Safari (#1253)
* fix: Fix CSS rules captured in Safari

* Apply formatting changes

* add changeset

* fix

---------

Co-authored-by: mydea <mydea@users.noreply.github.com>
2026-04-01 12:00:00 +08:00
Francesco Novy
5c3e1cf1e7 fix: Handle case where event is null/undefined (#1254)
* fix: Handle case where `event` is null/undefined

* add changeset
2026-04-01 12:00:00 +08:00
fukang wang
64328b8a0e fix: Resize and MediaInteraction events repeat generated after the iframe appeared (#1251)
* fix: Resize and MediaInteraction events repeat generated after the iframe appeared

* Create nervous-buses-pump.md

* Apply formatting changes

---------

Co-authored-by: wangfukang <wangfukang@kuaishou.com>
Co-authored-by: wfk007 <wfk007@users.noreply.github.com>
2026-04-01 12:00:00 +08:00
github-actions[bot]
7d91a1ad0c Version Packages (alpha) (#1216)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2026-04-01 12:00:00 +08:00
Justin Halsall
2e03e4da2a Fix types in rrwebPlayer (#1247)
* Export correct mirror in player

Was using DeprecatedMirror in its types, that shouldn't be used anymore.

* Add playRange to types

* Create smooth-poems-bake.md

* Apply formatting changes

* Add $set to player type

* Update smooth-poems-bake.md

* Apply formatting changes

* Last two arguments of playRange are optional
2026-04-01 12:00:00 +08:00
Eoghan Murray
f29a30bfb7 Guard against redefinition of Date.now (#1196)
* Guard against presence of likely older third party libraries which (re)define Date.now, e.g. https://github.com/datejs/Datejs/issues/92

* Apply formatting changes

* (remove nowTimestamp import where Date.now() is not used)

* Add a PURE marker so an empty `ìf` statement doesn't show up in the rrweb-replay output

* Update packages/rrweb/src/utils.ts

Fix typing issue with regex against `Date.now()`

Co-authored-by: Justin Halsall <Juice10@users.noreply.github.com>

* Create little-radios-thank.md

* Apply formatting changes

* Update .changeset/little-radios-thank.md

* Apply formatting changes

---------

Co-authored-by: eoghanmurray <eoghanmurray@users.noreply.github.com>
Co-authored-by: Justin Halsall <Juice10@users.noreply.github.com>
2026-04-01 12:00:00 +08:00
Eoghan Murray
e042576127 Update test commands (#1205)
* As per @Yun Feng: everyone has npm installed globally but maybe not yarn

* Add command to enable test result updating

* Default to running tests HEADLESS on rrweb

* Add command to build:all in a low memory environment

* Add a 'retest' command for when the code hasn't changed, but you are working on the test cases

* Add commands to reformat according to prettier. Named 'reformat' to indicate that we are doing a `--write`

* Update package.json

Co-authored-by: Yun Feng <yun.feng0817@gmail.com>

* Apply suggestions from code review

Co-authored-by: Yun Feng <yun.feng0817@gmail.com>

* Create few-turkeys-reflect.md

* Apply formatting changes

---------

Co-authored-by: Justin Halsall <Juice10@users.noreply.github.com>
Co-authored-by: Yun Feng <yun.feng0817@gmail.com>
2026-04-01 12:00:00 +08:00
Francesco Novy
ff54a2b097 fix: Ensure attributes are lowercased when checking (#1183)
* fix: Ensure attributes are lowercased when checking

* add changeset

* fix to lower case

* Apply formatting changes

---------

Co-authored-by: mydea <mydea@users.noreply.github.com>
2026-04-01 12:00:00 +08:00
Yun Feng
a539fd8f5b Fix rrdom bugs (#1222)
* fix: rrdom bug

1. fix one bug of the diff algorithm
2. omit srcdoc attribute of iframe

* use linked list to iterate children

* fix the bug that the children of shadowRoot don't get diffed

* add test cases

* add change log
2026-04-01 12:00:00 +08:00
Yun Feng
2294fc262e fix turbo dev command errors (#1229)
* fix turbo dev command errors

* Create forty-elephants-attack.md

---------

Co-authored-by: Justin Halsall <Juice10@users.noreply.github.com>
2026-04-01 12:00:00 +08:00
Eoghan Murray
6f0f7aada0 Avoid triggering a CSP (content security policy) error (#846)
* Fix for #816 - avoid triggering a CSP (content security policy) error with `.setAttribute('style')`

* The bare unattachedDoc that I previously naively created didn't have a doctype and wasn't a HTML document, so the child style element didn't have the `old.style` attribute available

* Add a try/catch to provide some robustness in case `document.implementation.createHTMLDocument` isn't available
2026-04-01 12:00:00 +08:00
Antonio Stipić
7456e57916 docs: add analyzee to readme (#1227)
Added analyzee as one of the SaaS that use rrweb in one of their products
2026-04-01 12:00:00 +08:00
fukang wang
d8ef6159e2 perf: optimize performance of the DoubleLinkedList get (#1220)
* perf: optimize performance of the DoubleLinkedList get

* fix: delete addedNodeIndexArr
2026-04-01 12:00:00 +08:00