fix: elements would lose some states like scroll position because of "virtual parent" optimization (#427)

* fix: elements would lose some state like scroll position because of "virtual parent" optimization

* refactor: the bugfix code

bug: elements would lose some state like scroll position because of "virtual parent" optimization

* fix: an error occured at applyMutation(remove nodes part)

error message:
Uncaught (in promise) DOMException: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node
This commit is contained in:
Lucky Feng
2020-11-27 17:46:52 +08:00
committed by GitHub
parent 658999c6e0
commit 96e4bfdddd
4 changed files with 76 additions and 0 deletions

View File

@@ -17,6 +17,7 @@ export declare class Replayer {
private legacy_missingNodeRetryMap;
private treeIndex;
private fragmentParentMap;
private elementStateMap;
private imageMap;
constructor(events: Array<eventWithTime | string>, config?: Partial<playerConfig>);
on(event: string, handler: Handler): this;
@@ -47,6 +48,8 @@ export declare class Replayer {
private hoverElements;
private isUserInteraction;
private backToNormal;
private storeState;
private restoreState;
private warnNodeNotFound;
private warnCanvasMutationFailed;
private debugNodeNotFound;

3
typings/types.d.ts vendored
View File

@@ -354,4 +354,7 @@ export declare enum ReplayerEvents {
StateChange = "state-change"
}
export declare type MaskInputFn = (text: string) => string;
export declare type ElementState = {
scroll?: [number, number];
};
export {};