Skip to content

Commit 7623008

Browse files
committed
We were calling inDom in all cases, so don't do the other ancestor checks if it goes bad early
1 parent 1d3dc2f commit 7623008

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

packages/rrweb/src/record/mutation.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -218,17 +218,17 @@ export default class MutationBuffer {
218218
// we have a new parentNode for a 'row' of DOM children
219219
// perf: we reuse these calculations across all child nodes
220220

221-
ancestorBad =
222-
isSelfOrAncestorInSet(this.droppedSet, parentNode) ||
223-
this.removesSubTreeCache.has(parentNode);
224-
225-
if (ancestorBad && isSelfOrAncestorInSet(this.movedSet, n)) {
226-
// not bad, just moved
227-
ancestorBad = false;
228-
}
229221
if (!inDom(parentNode)) {
230-
// this check should overrule moved also
231222
ancestorBad = true;
223+
} else {
224+
ancestorBad =
225+
isSelfOrAncestorInSet(this.droppedSet, parentNode) ||
226+
this.removesSubTreeCache.has(parentNode);
227+
228+
if (ancestorBad && isSelfOrAncestorInSet(this.movedSet, n)) {
229+
// not bad, just moved
230+
ancestorBad = false;
231+
}
232232
}
233233

234234
if (this.addedSet.has(parentNode.lastChild as Node)) {

0 commit comments

Comments
 (0)