diff --git a/packages/rrweb/src/record/mutation.ts b/packages/rrweb/src/record/mutation.ts index 097d1a8fd5..cdceaf50c1 100644 --- a/packages/rrweb/src/record/mutation.ts +++ b/packages/rrweb/src/record/mutation.ts @@ -425,7 +425,13 @@ export default class MutationBuffer { } break; } - candidate = node.previous; + if (node.value.previousSibling && isNodeInLinkedList(node.value.previousSibling)) { + candidate = node.value.previousSibling.__ln; + } else if (node.value.parentNode && isNodeInLinkedList(node.value.parentNode)) { + candidate = node.value.parentNode.__ln; + } else { + candidate = node.previous; + } addList.removeNode(node.value); pushAdd(node.value); }