Feat: Add support for replaying :defined pseudo-class of custom elements (#1155)

* Feat: Add support for replaying :defined pseudo-class of custom elements

* add isCustom flag to serialized elements

Applying Justin's review suggestion

* fix code lint error

* add custom element event

* fix: tests (#1348)

* Update packages/rrweb/src/record/observer.ts

* Update packages/rrweb/src/record/observer.ts

---------

Co-authored-by: Nafees Nehar <nafees87n@gmail.com>
Co-authored-by: Justin Halsall <Juice10@users.noreply.github.com>
This commit is contained in:
Yun Feng
2023-11-08 01:26:13 +11:00
committed by GitHub
parent dbd15a9492
commit 8aea5b00a4
14 changed files with 219 additions and 1 deletions

View File

@@ -83,6 +83,7 @@ export enum IncrementalSource {
StyleDeclaration,
Selection,
AdoptedStyleSheet,
CustomElement,
}
export type mutationData = {
@@ -142,6 +143,10 @@ export type adoptedStyleSheetData = {
source: IncrementalSource.AdoptedStyleSheet;
} & adoptedStyleSheetParam;
export type customElementData = {
source: IncrementalSource.CustomElement;
} & customElementParam;
export type incrementalData =
| mutationData
| mousemoveData
@@ -155,7 +160,8 @@ export type incrementalData =
| fontData
| selectionData
| styleDeclarationData
| adoptedStyleSheetData;
| adoptedStyleSheetData
| customElementData;
export type event =
| domContentLoadedEvent
@@ -262,6 +268,7 @@ export type hooksParam = {
canvasMutation?: canvasMutationCallback;
font?: fontCallback;
selection?: selectionCallback;
customElement?: customElementCallback;
};
// https://dom.spec.whatwg.org/#interface-mutationrecord
@@ -593,6 +600,14 @@ export type selectionParam = {
export type selectionCallback = (p: selectionParam) => void;
export type customElementParam = {
define?: {
name: string;
};
};
export type customElementCallback = (c: customElementParam) => void;
export type DeprecatedMirror = {
map: {
[key: number]: INode;