Commit Graph

62 Commits

Author SHA1 Message Date
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
Benoît Zugmeyer
ad816f7b7f reuse serialized nodes ids (#12)
* reuse serialized nodes ids

With this patch, each DOM node keeps its id during its existence. This
allows to apply RRWeb events to previous snapshots if needed.

`resetId` has been removed because it loses its meaning: calling it
would not reset the existing nodes ids anymore, only the new ones.

Since we don't reset the id anymore, we may exhaust the available ids
quicker, but Number.MAX_SAFE_INTEGER (2 ** 53 - 1) is pretty large, so I
doubt this'll cause any problem.

* improv TS typing

The `nAsINode` variable was not very elegant.  Simplify this by removing
the cast, and make the INode interface compatible with Node.

* update typings
2026-04-01 12:00:00 +08:00
Yanzhen Yu
cf5e17503d pass inline stylesheet option to iteratly 2026-04-01 12:00:00 +08:00
Yanzhen Yu
c4da047b9f add inline option which can bypass the inline stylesheet 2026-04-01 12:00:00 +08:00
Whalefreezer
68b97e40a2 add support for css @import rules (#11) 2026-04-01 12:00:00 +08:00
Yanzhen Yu
11f8a78f71 update typings 2026-04-01 12:00:00 +08:00
Yanzhen Yu
b72e01c2fc accept RegExp type block class config 2026-04-01 12:00:00 +08:00
Sam Mason
e21921a2da Make block css class optional & fix test (#6)
* Make block class optional

* Fix test by removing unexpected space space
2026-04-01 12:00:00 +08:00
Yanzhen Yu
29f2e42978 iterate style element to get css rules string 2026-04-01 12:00:00 +08:00
Yanzhen Yu
67027d8be6 handle empty url path 2026-04-01 12:00:00 +08:00
Yanzhen Yu
205d3b4aeb fix the format and use window.location 2026-04-01 12:00:00 +08:00
Daniël van de Giessen
4ed15164c9 Fixed detection of multiple consecutive CSS URLs without quotes (#4) 2026-04-01 12:00:00 +08:00
Daniël van de Giessen
61c50c2122 Parse style attributes for absolute URL paths (#5) 2026-04-01 12:00:00 +08:00
Yanzhen Yu
6259ae631d add camel case svg element tag names to tag map 2026-04-01 12:00:00 +08:00
Yanzhen Yu
ca8288802f do not add origin before data uri image 2026-04-01 12:00:00 +08:00
Yanzhen Yu
55ce53ffa0 close before open to make sure document was closed 2026-04-01 12:00:00 +08:00
Yanzhen Yu
259a929a76 delete not needed props 2026-04-01 12:00:00 +08:00
Yanzhen Yu
2d1d3596b8 handle block element 2026-04-01 12:00:00 +08:00
Yanzhen Yu
8b470ab6c8 remove _cssText attribute from style element 2026-04-01 12:00:00 +08:00
Yanzhen Yu
c458db3d8e ignore iframe src attribute 2026-04-01 12:00:00 +08:00
Yanzhen Yu
cdedca1716 complately update relative path regexp 2026-04-01 12:00:00 +08:00
Yanzhen Yu
08bee23494 fix absolute to doc 2026-04-01 12:00:00 +08:00
Yanzhen Yu
7cb33bfe80 fix css url regexp 2026-04-01 12:00:00 +08:00
Yanzhen Yu
c936cb6626 absolute relative path in inline stylesheet 2026-04-01 12:00:00 +08:00
Yanzhen Yu
e9786e7596 check is svg when serialization 2026-04-01 12:00:00 +08:00
Yanzhen Yu
2065e00c5d Fix the regexp performance issue
Also move the addHoverClass implementation into the rebuild stage.
So if there is still some corner case we have not handled, it will
only affect the replayer part of rrweb.
2026-04-01 12:00:00 +08:00
Yanzhen Yu
efcbd0faf1 add hover class to :hover related css rules 2026-04-01 12:00:00 +08:00
Yanzhen Yu
b964d18ef7 allow skip child when serialize node and rebuild node 2026-04-01 12:00:00 +08:00
Yanzhen Yu
9a4c21c30f refactor rebuild implementation which mount DOM onto the target document object 2026-04-01 12:00:00 +08:00
Yanzhen Yu
19eca4da6d use document object from params instead of the one in the current scope 2026-04-01 12:00:00 +08:00
Yanzhen Yu
349d78e02b fix style content url normalizer and add some tests 2026-04-01 12:00:00 +08:00
Yanzhen Yu
bbf23157c5 export reset id function 2026-04-01 12:00:00 +08:00
Yanzhen Yu
875385552d impl the extra child data attribute to align id map 2026-04-01 12:00:00 +08:00
Yanzhen Yu
e7753e1c24 change relative path into absolute path 2026-04-01 12:00:00 +08:00