Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copy css rules from style #11

Merged
merged 32 commits into from
Apr 22, 2024
Merged

Conversation

jaj1014
Copy link

@jaj1014 jaj1014 commented Apr 22, 2024

This PR contains changes to resolve several customer bugs related to playback issues around css rules getting dropped when style sheets are moved by rrdom's diff method.

I have also synced origin/master (pendo-io) w/ upstream/master (rrweb) and rebased my changes on that.


This change is Reviewable

eoghanmurray and others added 16 commits March 26, 2024 16:44
…o#1431)

* We weren't recursing into media queries (or @supports etc.) to rewrite hover pseudoclasses

* The early return meant that the stylesWithHoverClass cache wasn't being populated if there were no hover selectors on the stylesheet

 - not committing the test, but modifying the existing 'add a hover class to a previously processed css string' as follows shows the problem:

--- a/packages/rrweb-snapshot/test/rebuild.test.ts
+++ b/packages/rrweb-snapshot/test/rebuild.test.ts
@@ -151,6 +185,7 @@ describe('rebuild', function () {
         path.resolve(__dirname, './css/benchmark.css'),
         'utf8',
       );
+      cssText = cssText.replace(/:hover/g, '');

       const start = process.hrtime();
       addHoverClass(cssText, cache);

* Replace `min-device-width` and similar with `min-width` as the former looks out at the browser viewport whereas we need it to look at the replayer iframe viewport

* Add some tests to show how the hover replacement works against selector lists. I believe these were failing in a previous version of rrweb as I had some local patches that no longer seem to be needed to handle these cases

* Update name of function to reflect that 'addHoverClass' does more than just :hover. I believe this function is only exported for the purposes of use in the tests

* Apply formatting changes

* Create rotten-spies-enjoy.md

* Apply formatting changes

* Add correct typing on `getSelectors`

* Refactor CSS interfaces to include optional rules

* Change `rules` to be non optional

---------

Co-authored-by: eoghanmurray <eoghanmurray@users.noreply.github.com>
Co-authored-by: Justin Halsall <Juice10@users.noreply.github.com>
* Add HowdyGo to Who's using rrweb

* Create twenty-goats-kneel.md

---------

Co-authored-by: Justin Halsall <Juice10@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
* try/catch injection of recording script in rrweb repl and stream

* Add empty changesets
)

* fix: createImageBitmap throws DOMException if source is 0

* code review

* fix

* Create breezy-cats-heal.md

* fix format

---------

Co-authored-by: Justin Halsall <Juice10@users.noreply.github.com>
* protect against a missing parent node during a mutation on an textNode
…layer (rrweb-io#1408)

Expose constant SKIP_TIME_THRESHOLD as `inactivePeriodThreshold` config setting in replayer
…eb-io#1432)

* Add support for capturing media attributes in rrweb-snapshot

* Add loop to mediaInteractionParam

* Add support for loop in RRMediaElement

* Add support for recording loop attribute on media elements

* Update video playback and fix bugs

* Update cross-origin iframe media attributes and player state
* Fix known issues

* Run format

* Fix linting errors

* Add comment in code for source of match logic

* Add changeset
…xt" (rrweb-io#1369)

* Add "types" field to fix error when using "moduleResolution": "NodeNext".

* Add changeset.
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
* better splitting of selectors - overlapping with rrweb-io#1401 
* Add test from example at PostHog/posthog#21427
* ignore brackets inside selector strings
* Add another test as noticed that it's possible to escape strings
* Ensure we are ignoring commas within strings

Co-authored-by: Eoghan Murray <eoghan@getthere.ie>
…sion (rrweb-io#1441)

performance: remove a nested function call and an object clone during event emission

 - rename `event` to `eventWithoutTime`, but maintain backwards compatibility
 - `eventWithTime` (with time) could be renamed to `event` in a future version

This is an extension of PR rrweb-io#1339 authored by: mydea <mydea@users.noreply.github.com>
fix code for nodejs tests
change fix direction to avoid issues with duplicate styles
format issues
swap waitForTimeout for waitForRAF in test that flaked
Add unit tests for new functions
Fix broken test causes by file formatting removing spaced
@jaj1014
Copy link
Author

jaj1014 commented Apr 22, 2024

@mdellanoce and @colingm there is a conflict inside iframe-manager.ts that I think (?) we must've touched that is creating a conflict w/ some renaming that seems like it might relate to this PR.

As best I can tell, we added the takeFullSnapshot method, so that needs to persist and we can bring in their update from eventWithTime to eventWithoutTime for the wrappedEmit method.

The other conflict is just versioning in package.json that seems straight forward.

Can either of you have a look to confirm this?

Copy link

@dkindel dkindel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 10 of 71 files at r1, all commit messages.
Reviewable status: 10 of 71 files reviewed, all discussions resolved (waiting on @colingm and @mdellanoce)

colingm and others added 9 commits April 22, 2024 15:17
If we have cross origin record turned on but we are in a child
frame that has the same origin as its parent we end up in sort
of an inefficient state. We will start the recording, record
mutations, but then never actually emit them anywhere since
inEmittingFrame and passEmitsToParent are both false. This
is a waste of resources and we might as well just never start
the recording.
@jaj1014 jaj1014 force-pushed the ajax-copy-css-rules-from-style branch from fb5143a to 8b10795 Compare April 22, 2024 19:19
@dkindel dkindel merged commit a111704 into pendo-main Apr 22, 2024
6 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.