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

Single style capture #1437

Merged
merged 44 commits into from
Aug 6, 2024
Merged

Commits on Aug 2, 2024

  1. Unrelated, but the presence of a blank <style></style> element when…

    … checking the replay took me ages to debug as I thought it was something I introducedg
    eoghanmurray committed Aug 2, 2024
    Configuration menu
    Copy the full SHA
    ea9f096 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    385dee8 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    945bde3 View commit details
    Browse the repository at this point in the history
  4. Recognize that snapshot.ts::serializeTextNode does important work for…

    … mutations with `absoluteToStylesheet` - I had accidentally removed that with initial work
    eoghanmurray committed Aug 2, 2024
    Configuration menu
    Copy the full SHA
    a6ef9c4 View commit details
    Browse the repository at this point in the history
  5. Prep PR for async <style> serialization via assets: refactor stringif…

    …yStylesheet to happen in a single place during initial snapshot.
    eoghanmurray committed Aug 2, 2024
    Configuration menu
    Copy the full SHA
    bc769aa View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    b98c062 View commit details
    Browse the repository at this point in the history
  7. Multiple <style> text children: Demonstrate a failing test as CSS was…

    …n't being assigned to correct text node, and provide remedy whereby css text is properly re-split upon rebuild
    eoghanmurray committed Aug 2, 2024
    Configuration menu
    Copy the full SHA
    6df62e1 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    899911d View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    173cd0f View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    2983a19 View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    ee0fab5 View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    3f4e0b7 View commit details
    Browse the repository at this point in the history
  13. New function buildStyleNode to better encapsulate the separate behavi…

    …our there and some explanatory comments
    eoghanmurray committed Aug 2, 2024
    Configuration menu
    Copy the full SHA
    8d440c3 View commit details
    Browse the repository at this point in the history
  14. Configuration menu
    Copy the full SHA
    1d31ad7 View commit details
    Browse the repository at this point in the history
  15. Add the css text length to the splits array as a method of checking t…

    …hat the css hasn't been altered server-side/in-transit
    eoghanmurray committed Aug 2, 2024
    Configuration menu
    Copy the full SHA
    0067f5d View commit details
    Browse the repository at this point in the history
  16. Configuration menu
    Copy the full SHA
    7b5dda7 View commit details
    Browse the repository at this point in the history
  17. Add more tests and fix bug that was causing css text to end up in the…

    … second text child instead of the first
    eoghanmurray committed Aug 2, 2024
    Configuration menu
    Copy the full SHA
    27832fe View commit details
    Browse the repository at this point in the history
  18. Configuration menu
    Copy the full SHA
    7099d29 View commit details
    Browse the repository at this point in the history
  19. Realize we don't actually need to look at the .sheet during a mutat…

    …ion, even if there is only one text element on the <style>.
    
    Recent conversation with Justin has firmed up my thinking on why we look at .sheet in the first place (it's not because we want to get rid of vendor prefixes, which may actually be undesirable where they are useful for accurate replay in the replayer - but rather it's to ensure we don't miss any programmatic style mutations that have happened - have added comments to reflect this)
    eoghanmurray committed Aug 2, 2024
    Configuration menu
    Copy the full SHA
    2a7560a View commit details
    Browse the repository at this point in the history
  20. Fix the following typing problem in the tests:

    rrweb:test:     test/utils.ts:181:43 - error TS2345: Argument of type 'elementNode & { rootId?: number | undefined; isShadowHost?: boolean | undefined; isShadow?: boolean | undefined; } & { id: number; }' is not assignable to parameter of type '{ attributes: { src?: string | undefined; }; }'.
    rrweb:test:       Types of property 'attributes' are incompatible.
    rrweb:test:         Type 'attributes' has no properties in common with type '{ src?: string | undefined; }'.
    rrweb:test:
    rrweb:test:     181               stripBlobURLsFromAttributes(add.node);
    eoghanmurray committed Aug 2, 2024
    Configuration menu
    Copy the full SHA
    7a3d21e View commit details
    Browse the repository at this point in the history
  21. Highlight that there is a replayer involved in this test (as well as …

    …'record and replay style mutations')
    eoghanmurray committed Aug 2, 2024
    Configuration menu
    Copy the full SHA
    b357b43 View commit details
    Browse the repository at this point in the history
  22. Configuration menu
    Copy the full SHA
    91d29a5 View commit details
    Browse the repository at this point in the history
  23. Rather than recording a new separate error-prone _cssTextSplits attri…

    …bute, mark the splits directly within the _cssText using CSS comments
    eoghanmurray committed Aug 2, 2024
    Configuration menu
    Copy the full SHA
    45f2953 View commit details
    Browse the repository at this point in the history
  24. The blankTextNodes config option proved very confusing for both Jus…

    …tin and Yun - 'cssCaptured' should dovetail better with the stylesheet-assets branch where capturing will happen asynchronously
    eoghanmurray committed Aug 2, 2024
    Configuration menu
    Copy the full SHA
    9fe426d View commit details
    Browse the repository at this point in the history
  25. Simplify as I don't think this warning is actually needed, and tests …

    …should be covering all cases; would have only come into play if `applyCssSplits` was called without any child text nodes, which I can't imagine happening
    eoghanmurray committed Aug 2, 2024
    Configuration menu
    Copy the full SHA
    c5d1ef0 View commit details
    Browse the repository at this point in the history
  26. Caught a case where a text mutation, which bypasses _cssText, wasn'…

    …t getting rebuilt with `adaptCssForReplay`
    eoghanmurray committed Aug 2, 2024
    Configuration menu
    Copy the full SHA
    dd1bfee View commit details
    Browse the repository at this point in the history
  27. Configuration menu
    Copy the full SHA
    46aa8f2 View commit details
    Browse the repository at this point in the history
  28. I suspected this style of mutation was going to result in duplicate t…

    …ext content, but I was mistaken; adding as I think it still has value in terms of regression
    eoghanmurray committed Aug 2, 2024
    Configuration menu
    Copy the full SHA
    8b9cc06 View commit details
    Browse the repository at this point in the history
  29. Include another type of <style> addition to ensure it doesn't duplica…

    …te content in mutation between _cssText and a text node
    eoghanmurray committed Aug 2, 2024
    Configuration menu
    Copy the full SHA
    3e9edbc View commit details
    Browse the repository at this point in the history
  30. Fix case where we wouldn't have been able to mutate a <style> text no…

    …de after a mutation as it's textContent wasn't getting a serialized id
    eoghanmurray committed Aug 2, 2024
    Configuration menu
    Copy the full SHA
    b9622d0 View commit details
    Browse the repository at this point in the history
  31. Prefer waitForRAF

    eoghanmurray committed Aug 2, 2024
    Configuration menu
    Copy the full SHA
    a9d14ea View commit details
    Browse the repository at this point in the history
  32. feat: add test for recording and replaying style mutations with multi…

    …ple child nodes
    
    Add a new integration test to verify that style mutations with multiple child nodes are recorded and replayed correctly. The test sets the color of two div elements using CSS and verifies that the color is applied correctly after replaying the recorded events.
    Juice10 authored and eoghanmurray committed Aug 2, 2024
    Configuration menu
    Copy the full SHA
    3156575 View commit details
    Browse the repository at this point in the history
  33. This is the effect of the following two changesets:

     - Don't record css content twice when a <style> element is added in a mutation
     - Fix case where we wouldn't have been able to mutate a <style> text node after a mutation as it's textContent wasn't getting a serialized id
    eoghanmurray committed Aug 2, 2024
    Configuration menu
    Copy the full SHA
    b358827 View commit details
    Browse the repository at this point in the history
  34. Configuration menu
    Copy the full SHA
    217e149 View commit details
    Browse the repository at this point in the history
  35. Configuration menu
    Copy the full SHA
    b932c98 View commit details
    Browse the repository at this point in the history
  36. Fixup eslint

    eoghanmurray committed Aug 2, 2024
    Configuration menu
    Copy the full SHA
    876b109 View commit details
    Browse the repository at this point in the history
  37. Some extra reminder on these tests as I believe 'can record and repla…

    …y style mutations' covers more ground.
    
    Could probably emphasize that these 2 are related to `insertRule` i.e. programmatic mutations as opposed to text mutations
    eoghanmurray committed Aug 2, 2024
    Configuration menu
    Copy the full SHA
    39007f1 View commit details
    Browse the repository at this point in the history
  38. Fix regression on test [html file]: with-style-sheet-with-import.html

    The prior 'dynamic stylesheet' route is now the main route for serializing a stylesheet; dynamic stylesheet were missed out in rrweb-io#1533 but are caught in this PR by the tests added in that PR as the stylesheet handling is simplified/centralised
    eoghanmurray committed Aug 2, 2024
    Configuration menu
    Copy the full SHA
    34def57 View commit details
    Browse the repository at this point in the history
  39. Make algorithm easier to understand while still ensuring the 'maintai…

    …ns entire css text when there are too few child nodes' passes
    
    Co-authored-by: Justin Halsall <[email protected]>
    eoghanmurray and Juice10 committed Aug 2, 2024
    Configuration menu
    Copy the full SHA
    f40a053 View commit details
    Browse the repository at this point in the history
  40. add 'type' keyword in css.test.ts

    Co-authored-by: Justin Halsall <[email protected]>
    eoghanmurray and Juice10 committed Aug 2, 2024
    Configuration menu
    Copy the full SHA
    7a93a1d View commit details
    Browse the repository at this point in the history
  41. Configuration menu
    Copy the full SHA
    83b3482 View commit details
    Browse the repository at this point in the history
  42. Add break to short circuit when normalized string found

    Co-authored-by: Justin Halsall <[email protected]>
    eoghanmurray and Juice10 committed Aug 2, 2024
    Configuration menu
    Copy the full SHA
    63d79fb View commit details
    Browse the repository at this point in the history
  43. Configuration menu
    Copy the full SHA
    9770a16 View commit details
    Browse the repository at this point in the history
  44. Add stripping of css comments and also semicolons to the `normalizeCs…

    …sString` function (thanks Justin). Add test to show when this matters
    eoghanmurray committed Aug 2, 2024
    Configuration menu
    Copy the full SHA
    58bfecc View commit details
    Browse the repository at this point in the history