rrweb icon indicating copy to clipboard operation
rrweb copied to clipboard

replay `:hover` rewrite - instead mutate stylesheets

Open eoghanmurray opened this issue 1 year ago • 1 comments

switch to model where we adapt the replay stylesheets programmatically after they have been added to the page instead of parsing the text

  • means we don't have to rely on regexp parsing of raw cssText text value to ensure we are substituting css selectors and media statements correctly
  • could be adapted in future for use against external (non inlined) <link> stylesheets during replay

#1458 points out failings in the current css parsing, and switches to postcss. This is an alternative to that and removes all 3rd party dependencies.

This PR could also be a contender as a fix for #1478 (although I suspect something else is the matter there, as I couldn't create a stylesheet with the CSS text from that)

How to help:

  • [ ] satisfy eslint by removing the ignore line and upgrading typescript to a version that incorporates https://github.com/Microsoft/TypeScript/issues/23406 bugfix
  • [ ] ensure we are applying adaptStylesheetForReplay after a virtual dom operation (i.e. fastforward in replayer which has a diff of adding a new stylesheet)
  • [ ] add back the caching support (I'm not sure how as the stylesheet for which we've adapted things is mutable)
  • [ ] verify replay performance is better or isn't affected

eoghanmurray avatar May 17 '24 17:05 eoghanmurray

🦋 Changeset detected

Latest commit: 0a04127224bdc6d405f1b7b50fdc5708f240e22b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 8 packages
Name Type
rrweb-snapshot Patch
rrweb Patch
rrdom Patch
rrdom-nodejs Patch
rrweb-player Patch
@rrweb/types Patch
@rrweb/web-extension Patch
rrvideo Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

changeset-bot[bot] avatar May 17 '24 17:05 changeset-bot[bot]