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

impl #650, CSS declaration observer #671

Merged
merged 1 commit into from
Aug 23, 2021
Merged

Conversation

Yuyz0112
Copy link
Member

@Yuyz0112 Yuyz0112 commented Aug 18, 2021

CSS declaration observer

The Issue

There are browser APIs that can modify the value of CSS declaration by setting property and removing property. So we need to observe these changes and replay them.

The implementation

The CSS declaration observer was implemented in the general pattern and follow the latest design of @Juice10, e.g, using array index to handle nesting and store changes in virtual style when using a fragment.

Decisions

Two small designs do not fit well but can be improved in the following patches, without blocking this feature.

  1. getNestedRule not return CSSGroupingRule, but in this scenario, it can return CSSStyleRule.
  2. The naming of states in the virtual style module is XXXRule, so it's a little confusing to naming an operation to CSS rule.

@Yuyz0112 Yuyz0112 force-pushed the css-declaration-observer branch from 60fe27a to fdea178 Compare August 18, 2021 05:48
@Yuyz0112 Yuyz0112 requested a review from Juice10 August 18, 2021 14:17
@Yuyz0112 Yuyz0112 merged commit 5dcbfa5 into master Aug 23, 2021
eoghanmurray added a commit to statcounter/rrweb that referenced this pull request Sep 29, 2021
eoghanmurray added a commit to statcounter/rrweb that referenced this pull request Sep 29, 2021
Yuyz0112 pushed a commit that referenced this pull request Oct 1, 2021
* `setTimeout` and `clearTimeout` are global functions. Think the window versions of them were for the following reason: https://stackoverflow.com/questions/60245787/

* Comments and extra test here helped me understand which inserts were expected and which are to be ignored

* Add a test for the style setProperty/removeProperty added in #671

* Add a test to ensure that listeners get added correctly in nested iframes - particularly important for those which rely on prototype monkeypatching

* Pass in the window object from the current iframe so that monkeypatching applies to all windows

* Satisfy typings

* No need to insert an iframe as there's one already set up for us

* Enable the console logger to also intercept log messages within iframes

* There's no tests for FontFace but presumably the monkeypatching here works similarly to the others
@YunFeng0817 YunFeng0817 deleted the css-declaration-observer branch July 11, 2022 06:18
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.

1 participant