forked from rrweb-io/rrweb
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug fix and regression test for rrweb-io#112
- this is to fix up 'historical' recordings, as duplicate textarea content should no longer be being created at record time (see previous commit in this PR) - new test shows what the snapshot generated by previous versions of rrweb used to look like, hence 'bad' - original 0efe23f fix either didn't work or no longer works due to childNodes being appended subsequent to this part of the code
- Loading branch information
1 parent
4f4b00a
commit 96cc446
Showing
3 changed files
with
98 additions
and
7 deletions.
There are no files selected for viewing
This file contains 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 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,80 @@ | ||
import { EventType, IncrementalSource } 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 + 50, | ||
}, | ||
{ | ||
type: EventType.Meta, | ||
data: { | ||
href: 'http://localhost', | ||
width: 1000, | ||
height: 800, | ||
}, | ||
timestamp: now + 50, | ||
}, | ||
// 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: 'body', | ||
attributes: {}, | ||
childNodes: [ | ||
{ | ||
id: 6, | ||
type: 2, | ||
tagName: 'textarea', | ||
attributes: { | ||
value: 'dupe', | ||
}, | ||
childNodes: [ | ||
{ | ||
type: 3, | ||
textContent: 'dupe should ignore', | ||
id: 7, | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
initialOffset: { top: 0, left: 0 }, | ||
}, | ||
type: EventType.FullSnapshot, | ||
timestamp: now + 50, | ||
}, | ||
]; | ||
|
||
export default events; |
This file contains 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