-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Feat: Add support for replaying :defined pseudo-class of custom elements #1155
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
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
555d3fc
Feat: Add support for replaying :defined pseudo-class of custom elements
YunFeng0817 cef51f3
add isCustom flag to serialized elements
YunFeng0817 56e0bb5
Merge branch 'master' into defined-pseudo-class
YunFeng0817 5302912
fix code lint error
YunFeng0817 d5dae21
add custom element event
YunFeng0817 583276c
Merge branch 'master' into defined-pseudo-class
YunFeng0817 811f56e
Merge commit '1fe39ab0db7f5d2b04f4a4f39fb5c0cfee33a1f8' into defined-…
YunFeng0817 11be49a
Merge remote-tracking branch 'origin/master' into defined-pseudo-class
YunFeng0817 4e8d4ba
fix: tests (#1348)
nafees87n 8b6f799
Update packages/rrweb/src/record/observer.ts
Juice10 8cb6266
Update packages/rrweb/src/record/observer.ts
Juice10 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| 'rrweb': patch | ||
| --- | ||
|
|
||
| Feat: Add support for replaying :defined pseudo-class of custom elements |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| --- | ||
| 'rrweb-snapshot': patch | ||
| --- | ||
|
|
||
| Feat: Add 'isCustom' flag to serialized elements. | ||
|
|
||
| This flag is used to indicate whether the element is a custom element or not. This is useful for replaying the :defined pseudo-class of custom elements. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,89 @@ | ||
| import { EventType } from '@rrweb/types'; | ||
| import type { eventWithTime } from '@rrweb/types'; | ||
|
|
||
| const now = Date.now(); | ||
| const events: eventWithTime[] = [ | ||
| { | ||
| type: EventType.DomContentLoaded, | ||
| data: {}, | ||
| timestamp: now, | ||
| }, | ||
| { | ||
| type: EventType.Load, | ||
| data: {}, | ||
| timestamp: now + 100, | ||
| }, | ||
| { | ||
| type: EventType.Meta, | ||
| data: { | ||
| href: 'http://localhost', | ||
| width: 1000, | ||
| height: 800, | ||
| }, | ||
| timestamp: now + 100, | ||
| }, | ||
| // full snapshot: | ||
| { | ||
| data: { | ||
| node: { | ||
| id: 1, | ||
| type: 0, | ||
| childNodes: [ | ||
| { id: 2, name: 'html', type: 1, publicId: '', systemId: '' }, | ||
| { | ||
| id: 3, | ||
| type: 2, | ||
| tagName: 'html', | ||
| attributes: { lang: 'en' }, | ||
| childNodes: [ | ||
| { | ||
| id: 4, | ||
| type: 2, | ||
| tagName: 'head', | ||
| attributes: {}, | ||
| childNodes: [ | ||
| { | ||
| id: 5, | ||
| type: 2, | ||
| tagName: 'style', | ||
| childNodes: [ | ||
| { | ||
| id: 6, | ||
| type: 3, | ||
| isStyle: true, | ||
| // Set style of defined custom element to display: block | ||
| // Set undefined custom element to display: none | ||
| textContent: | ||
| 'custom-element:not(:defined) { display: none;} \n custom-element:defined { display: block; }', | ||
| }, | ||
| ], | ||
| }, | ||
| ], | ||
| }, | ||
| { | ||
| id: 7, | ||
| type: 2, | ||
| tagName: 'body', | ||
| attributes: {}, | ||
| childNodes: [ | ||
| { | ||
| id: 8, | ||
| type: 2, | ||
| tagName: 'custom-element', | ||
| childNodes: [], | ||
| isCustom: true, | ||
| }, | ||
| ], | ||
| }, | ||
| ], | ||
| }, | ||
| ], | ||
| }, | ||
| initialOffset: { top: 0, left: 0 }, | ||
| }, | ||
| type: EventType.FullSnapshot, | ||
| timestamp: now + 100, | ||
| }, | ||
| ]; | ||
|
|
||
| export default events; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.