Commit Graph

95 Commits

Author SHA1 Message Date
yz-yu
b0508d4df4 nested record iframe (#63)
* pick nested branch

* iframe snapshot

* temp: add bundle file to git

* revert ignore file

* refactor iframe impl
1. do callback one iframe is loaded, let rrweb handle the rest
2. handle iframe as normal element in rebuild

* rename hook function
2026-04-01 12:00:00 +08:00
Yanzhen Yu
af61cab872 fix href value 2026-04-01 12:00:00 +08:00
丶Cccccc
53f51e0e8e bugfix: svg url中id name被误转为绝对路径 (#59)
Co-authored-by: wanglei002 <wanglei002@sensorsdata.cn>
2026-04-01 12:00:00 +08:00
cgf
451bf457cc svg xlink:href 路径问题 (#55)
* feat: 修改在svg , xlink:href 相对路径改为绝对路径

* feat: 修改在svg , xlink:href 路径

* feat: 修改在svg, 图片路径问题

* feat: 修改在svg, 图片路径问题

* feat: 修改在svg , xlink:href 路径

Co-authored-by: caogf <caogf@guahao.com>
2026-04-01 12:00:00 +08:00
Yanzhen Yu
3a946702c2 fix https://github.com/rrweb-io/rrweb-snapshot/issues/56
safe access tagName of form element
2026-04-01 12:00:00 +08:00
Yanzhen Yu
c7966070ef fix https://github.com/rrweb-io/rrweb/issues/395 2026-04-01 12:00:00 +08:00
Yanzhen Yu
a9ef2cfa83 refactoring public API 2026-04-01 12:00:00 +08:00
Yanzhen Yu
6852da5fe5 close #38, update data uri regexp 2026-04-01 12:00:00 +08:00
Yanzhen Yu
40d754884a fix lint 2026-04-01 12:00:00 +08:00
Karl-Aksel Puulmann
0c62d31002 Allow blocking elements by selector (#50)
* Extract method (isElementBlocked) and add tests

* Add blockSelector argument to snapshot

If blockSelector is passed, it will be matched against the element.

Reasoning: Mutating class names can get messy, so providing another hook
helps keep code clean by using data-attributes instead.
2026-04-01 12:00:00 +08:00
Eoghan Murray
65671be739 Add ability to reset the mapping id, to facilitate destructor in rrweb (rrwebRecord.stop) (#49) 2026-04-01 12:00:00 +08:00
Eoghan Murray
b005450c64 Prefer a map and a join as feel it's easier to understand, and I found a case in the wild where Array.prototype.reduce was overwritten (which admittedly is also a danger with map) (#52) 2026-04-01 12:00:00 +08:00
Eoghan Murray
28917d1c9a Preserve url quotes (#47)
* Preserve original quotes when rewriting CSS url() paths - important for inline SVG files which often have spaces

* Found an example in the wild with the 'charset=' part left off. This is supported by https://css-tricks.com/lodge/svg/09-svg-data-uris/ ... not sure why we aren't just testing for the 'data:' prefix here?

* Not sure why this is now coming back with a double quote after recent changes here; it's supposed to preserve the single quote from style.css??
2026-04-01 12:00:00 +08:00
Eoghan Murray
71b6e683c0 Add a slimDOM option to strip out unnecessary parts of the DOM (#36)
* Add a `slimDOM` option to strip out unnecessary parts of the DOM in terms of replay

 - <script> tags in the <head> take up unnecessary storage space and are often injected semi randomly to become a source of unnecessary variation between recordings of the same thing
 - comment tags can be stripped out without affecting display
 - future: this option could also turn on more aggressive stripping, e.g. elements that are hidden by CSS (assuming we can handle them becoming visible after mutation events)

* Mark nodes ignored due to slimDOM option, so that they can also be ignored by the mutation observer in rrweb

* Introducing the `ignored` attribute violates the `serializedNodeWithId` type

* slimDOM: Strip out whitespace nodes from <head> element as they have no effect but take up space

 - these would otherwise have to be merged after <script> elements are removed; for statcounter usecase, removing
   <script> elements is no good if there is still a trace of their presence due to the white space (and hence a variant <head> node is still produced)
 - I explored a more radical stripping of all white space nodes, but there is a problem if parent node is <pre> or otherwise rendered with `white-space: pre` and similar.
   detecting applied styles with getComputedStyle would be very expensive (I haven't measured it though)

* Export IGNORED_NODE as a constant instead of relying on the hard-to-grok `-2`

* Remove <link rel=preload as=script> which are similarly as useless as <script> tags

* Make slimDOM configurable with the expecations that `slimDOMOptions: true` will only enable non-destructive options (so not all options may be turned on)

* Expand slimDOM to add options to remove more elements from the <head> that should not be necessary in the replayer context
2026-04-01 12:00:00 +08:00
Yanzhen Yu
79f1ba574a close #42 fallback to html when doctype is invalid 2026-04-01 12:00:00 +08:00
Yanzhen Yu
287a6073c0 add an option to enable/disable take canvas snapshot 2026-04-01 12:00:00 +08:00
Yanzhen Yu
41868e2265 rename visit to visitSnapshot 2026-04-01 12:00:00 +08:00
Yanzhen Yu
52aac74fa2 add visit function for snapshot 2026-04-01 12:00:00 +08:00
Yanzhen Yu
29fcf03d4f provide a general visit function to modify rebuilt id node map 2026-04-01 12:00:00 +08:00
Eoghan Murray
cd601571ea Expand what is considered to be a valid tag name to include underscores: (#41)
- was making this change for <wix-image> on Wix websites, but discovered after that this has already been done in e4593ff76d
 - have tested document.createElement('wix-image') and document.createElement('foo_bar'), but can't find a canonical source for what is allowed in tag names.
 - this restriction was originally introduced in #150 to prevent document.createElement('alt=""') i.e. a very malformed tag name
2026-04-01 12:00:00 +08:00
Jason Barry
949c236e29 Fixes missing space when converting srcset to use absolute URLs (#40)
* Fixes missing space when converting srcset to use absolute URLs

* Fix integration snapshot
2026-04-01 12:00:00 +08:00
吴泽康
1c43577807 Add nested scroll support (#31) 2026-04-01 12:00:00 +08:00
Yanzhen Yu
ec7e944a3d add textarea and select to default options 2026-04-01 12:00:00 +08:00
Yanzhen Yu
8592fbd05b support mask select fields 2026-04-01 12:00:00 +08:00
Yanzhen Yu
b4a3d4c66a fix mask textarea 2026-04-01 12:00:00 +08:00
Yanzhen Yu
02123b2874 part of rrweb #80, support configure mask input types 2026-04-01 12:00:00 +08:00
Eoghan Murray
79fe0d1fd8 Don't obscure text of form buttons under maskAllInputs (more modern style would be a <button>) (#35) 2026-04-01 12:00:00 +08:00
Maxim Postautov
f22402d39d add '-' to symbolAndNumberRegex (#34) 2026-04-01 12:00:00 +08:00
Eoghan Murray
dc56ec274a Avoid more common causes of 'blocked script execution' console.error messages in Chrome which are not exceptions (but look like them): (#30)
'Blocked script execution in '<page>' because the document's frame is sandboxed and the 'allow-scripts' permission is not set'
2026-04-01 12:00:00 +08:00
James Bradley
bfaff6b0e1 H tags (#28)
* Failing test

* Allow numbers in el name tests

* Allow numbers in el names
2026-04-01 12:00:00 +08:00
Fizer Khan (பைசர் கான்)
6a34c7a2e5 fix null issue. (#27) 2026-04-01 12:00:00 +08:00
Yanzhen Yu
f29c5abfbc close #24 css text can be null 2026-04-01 12:00:00 +08:00
Yanzhen Yu
35070d9dcc add media state check 2026-04-01 12:00:00 +08:00
Filip Slatinac
44eddcc900 added cssText check (#23)
* added cssText check

* added testing
2026-04-01 12:00:00 +08:00
Filip Slatinac
5c23514fca replacing invalid tag names by div (#22) 2026-04-01 12:00:00 +08:00
Yanzhen Yu
af7f8d9404 export the transform attribute method 2026-04-01 12:00:00 +08:00
Yanzhen Yu
927f754a9d format code 2026-04-01 12:00:00 +08:00
吴泽康
94d64e3424 Add canvas image content support (#20)
* Add canvas image content support

* use rr_dataURL as the key so we know its a rrweb-added attribute.

* fix canvas rr_dataURL rebuild
2026-04-01 12:00:00 +08:00
Filip Slatinac
1467f97f43 Added srcset support (#18)
* added src set as a parsed attribute

* added tests

* changed to /a

* added multiple attribute handling

* added better comment

* made snapshot ignore invalid input as if it is invalid input in the original DOM, it should stay invalid in the recreated DOM

* added extra absolute test case

* code style

* addressed comments
2026-04-01 12:00:00 +08:00
Yanzhen Yu
a860cf9ed5 export add hover class method 2026-04-01 12:00:00 +08:00
Yanzhen Yu
1fc66ffcc5 fix data url regexp 2026-04-01 12:00:00 +08:00
yz-yu
cbe23963a0 add the HACK_CSS flag to bypass css parsing (#16) 2026-04-01 12:00:00 +08:00
Yanzhen Yu
2ba72c3a29 pass mask all input option recursively 2026-04-01 12:00:00 +08:00
dphuang2
939eddcca5 Ignore broken CSS (#15)
Broken CSS inside a page will throw an error on our behalf. This should
be ignored because we are not in control of the CSS on the page we are
recording.
2026-04-01 12:00:00 +08:00
Yanzhen Yu
fbfdafae34 remove child node before set default value 2026-04-01 12:00:00 +08:00
Yanzhen Yu
6457f9ff62 fix #14 fix innerText cap issue 2026-04-01 12:00:00 +08:00
Yanzhen Yu
21e8affa2b Use css parser to add hover class name to selectors.
Previously we use a regexp to match all the CSS selectors and add
our hover class name to it, which has been proved not solid and
may be very slow in some situation.
Using a production ready css parser can handle this better and also
provide ability's to do more accurate things to the recorded
stylesheets.
2026-04-01 12:00:00 +08:00
Yanzhen Yu
6ecaaa2560 add mask all inputs option to snapshot 2026-04-01 12:00:00 +08:00
Yanzhen Yu
1a3b17bae4 format code 2026-04-01 12:00:00 +08:00
Razvan Sandu
149c78802a Allow rendering image tags inside svgs during replay (#13) 2026-04-01 12:00:00 +08:00