Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Rebase and merge
  • Loading branch information
rahulrelicx committed Apr 14, 2022
commit 627d20574f37e01a9414787b3b67cb74ecee42b6
11 changes: 7 additions & 4 deletions packages/rrweb/src/record/mutation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import {
isAncestorRemoved,
isIgnored,
isSerialized,
isIframeINode,
hasShadowRoot,
isSerializedIframe,
} from '../utils';
Expand Down Expand Up @@ -523,9 +522,13 @@ export default class MutationBuffer {
m.removedNodes.forEach((n) => {
const nodeId = this.mirror.getId(n);
const parentId = isShadowRoot(m.target)
? this.mirror.getId((m.target.host as unknown) as INode)
: this.mirror.getId(m.target as INode);
if (isBlocked(m.target, this.blockClass) || isIgnored(n) || !isSerialized(n)) {
? this.mirror.getId(m.target.host)
: this.mirror.getId(m.target);
if (
isBlocked(m.target, this.blockClass) ||
isIgnored(n, this.mirror) ||
!isSerialized(n)
) {
return;
}
// removed node has not been serialized yet, just remove it from the Set
Expand Down
7 changes: 2 additions & 5 deletions packages/rrweb/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,14 +213,11 @@ export function isBlocked(node: Node | null, blockClass: blockClass): boolean {
return isBlocked(node.parentNode, blockClass);
}

export function isSerialized(n: Node | INode): boolean {
export function isSerialized(n: Node): boolean {
return '__sn' in n;
}

export function isIgnored(n: Node | INode): boolean {
if ('__sn' in n) {
return (n as INode).__sn.id === IGNORED_NODE;
}
export function isIgnored(n: Node, mirror: Mirror): boolean {
// The main part of the slimDOM check happens in
// rrweb-snapshot::serializeNodeWithId
return mirror.getId(n) === IGNORED_NODE;
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.