pick #286, export slim DOM options

This commit is contained in:
Yanzhen Yu
2020-11-29 14:19:25 +08:00
parent a42b6419c3
commit 3d5f2e2719
5 changed files with 78 additions and 21 deletions

View File

@@ -15,7 +15,7 @@ import {
scrollData,
inputData,
} from './types';
import { INode } from 'rrweb-snapshot';
import { INode, IGNORED_NODE } from 'rrweb-snapshot';
export function on(
type: string,
@@ -197,6 +197,15 @@ export function isBlocked(node: Node | null, blockClass: blockClass): boolean {
return isBlocked(node.parentNode, blockClass);
}
export function isIgnored(n: Node | INode): boolean {
if ('__sn' in n) {
return (n as INode).__sn.id === IGNORED_NODE;
}
// The main part of the slimDOM check happens in
// rrweb-snapshot::serializeNodeWithId
return false;
}
export function isAncestorRemoved(target: INode): boolean {
const id = mirror.getId(target);
if (!mirror.has(id)) {