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

Apply textContent on flush #865

Merged
merged 3 commits into from
Mar 27, 2022
Merged

Apply textContent on flush #865

merged 3 commits into from
Mar 27, 2022

Conversation

Juice10
Copy link
Contributor

@Juice10 Juice10 commented Mar 25, 2022

When scrubbing through replays I bumped into the issue that textContent doesn't always get applied on stylesheets.
This PR fixes that issue and adds tests for a number of edge cases

@YunFeng0817
Copy link
Member

This is a great fix and could you please also see whether #853 solves this problem or not?

@Yuyz0112 Yuyz0112 merged commit 072b81b into master Mar 27, 2022
@Juice10
Copy link
Contributor Author

Juice10 commented Mar 27, 2022

This is a great fix and could you please also see whether #853 solves this problem or not?

@Mark-Fenng #853 solves the "should apply fast-forwarded StyleSheetRules that came after stylesheet textContent overwrite" test case, but doesn't solve the "should overwrite all StyleSheetRules by replacing style element's textContent while fast-forwarding" test case that was added in this PR.

Test results:

 replayer › should overwrite all StyleSheetRules by replacing style element's textContent while fast-forwarding

    expect(received).toEqual(expected) // deep equality

    Expected: false
    Received: true

      327 |     `);
      328 |
    > 329 |     expect(result).toEqual(false);
          |                    ^
      330 |   });
      331 |
      332 |   it('should apply fast-forwarded StyleSheetRules that came after stylesheet textContent overwrite', async () => {

      at test/replayer.test.ts:329:20
      at step (test/replayer.test.ts:34:23)
      at Object.next (test/replayer.test.ts:15:53)
      at fulfilled (test/replayer.test.ts:6:58)

YunFeng0817 added a commit that referenced this pull request Mar 27, 2022
@Juice10 Juice10 deleted the stylesheet.textContent branch March 28, 2022 08:56
Yuyz0112 pushed a commit that referenced this pull request May 12, 2022
…tion (#895)

* rrdom: add a diff function for properties

* implement diffChildren function and unit tests

* finish basic functions of diff algorithm

* fix several bugs in the diff algorithm

* replace the virtual parent optimization in applyMutation()

* fix: moveAndHover after the diff algorithm is executed

* replace virtual style map with rrdom

cssom version has to be above 0.5.0 to pass virtual style tests

* fix: failed virtual style tests in replayer.test.ts

* fix: failed polyfill tests caused by nodejs compatibility of different versions

* fix: svg viewBox attribute doesn't work

Cause the attribute viewBox is case sensitive, set value for viewbox doesn't work

* feat: replace treeIndex optimization with rrdom

* fix bug of diffProps and disable smooth scrolling animation in fast-forward mode

* feat: add iframe support

* fix: @rollup/plugin-typescript build errors in rrweb-player

Error: @rollup/plugin-typescript TS1371: This import is never used as a value and must use 'import type' because the 'importsNotUsedAsValues' is set to 'error'

* fix: bug when fast-forward input events and add test for it

* add test for fast-forward scroll events

* fix: custom style rules don't get inserted into some iframe elements

* code style tweak

* fix: enable to diff iframe elements

* fix  the jest error "Unexpected token 'export'"

* try to fix build error of rrweb-player

* correct the attributes definition in rrdom

* fix: custom style rules are not inserted in some iframes

* add support for shadow dom

* add support for MediaInteraction

* add canvas support

* fix unit test error in rrdom

* add support for Text, Comment

* try to refactor RRDom

* refactor RRDom to reduce duplicate code

* rename document-browser to virtual-dom

* increase the test coverage for document.ts and add ownerDocument for it

* Merge branch 'master' into virtual-dom

* add more test for virtual-dom.ts

* use cssstyle in document-nodejs

* fix: bundle error

* improve document-nodejs

* enable to diff scroll positions of an element

* rename rrdom to virtualDom for more readability and make the tree public

* revert unknown change

* improve the css style parser for comments

* improve code style

* update typings

* add handling for the case where legacy_missingNodeRetryMap is not empty

* only import types from rrweb into rrdom

* Apply suggestions from code review

Co-authored-by: Justin Halsall <[email protected]>

* Apply suggestions from code review

* fix building error in rrweb

* add a method setDefaultSN to set a default value for a RRNode's __sn

* fix rrweb test error and bump up other packages

* add support for custom property of css styles

* add a switch for virtual-dom optimization

* Apply suggestions from code review

1. add an enum type for NodeType
2. rename nodeType from rrweb-snapshot to RRNodeType
3. rename notSerializedId to unserializedId
4. add comments for some confusing variables

* adapt changes of #865 to virtual-dom and improve the test case for more coverage

* apply review suggestions

#853 (review)

* tweak the diff algorithm

* add description of the flag useVirtualDom and remove outdated logConfig

* Remove console.log

* Contain changes to document

* Upgrade rollup to 2.70.2

* Revert "Upgrade rollup to 2.70.2"

This reverts commit b1be81a.

* Fix type checking rrdom

* Fix typing error while bundling

* Fix tslib error on build

Rollup would output the following error:
`semantic error TS2343: This syntax requires an imported helper named '__spreadArray' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'.`

* Increase memory limit for rollup

* Use esbuild for bundling

Speeds up bundling significantly

* Avoid circular dependencies and import un-bundled rrdom

* Fix imports

* Revert back to pre-esbuild

This reverts the following commits:
b7b3c8d
72e23b8
85d600a
61e1a5d

* Set node to lts (12 is no longer supported)

* Speed up bundling and use less memory

This fixes the out of memory errors happening while bundling

* remove __sn from rrdom

* fix typo

* test: add a test case for StyleSheet mutation exceptions while fast-forwarding

* rename Array.prototype.slice.call() to Array.from()

* improve test cases

* fix: PR #887 in 'virtual-dom' branch

* apply justin's suggestion on 'Array.from' refactor

related commit 0f6729d

* improve import code structure

Co-authored-by: Yun Feng <[email protected]>
Copy link

@Karliz24 Karliz24 left a comment

Choose a reason for hiding this comment

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

Excelente

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.

4 participants