From ea1a9da6a5bbfbe623eb1de3459e26641ce5791a Mon Sep 17 00:00:00 2001 From: Yanzhen Yu Date: Sat, 16 Jan 2021 22:31:57 +0800 Subject: [PATCH] fix #460 ignore added node that are not in document anymore --- src/record/mutation.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/record/mutation.ts b/src/record/mutation.ts index 9d90daf9..3689c1b8 100644 --- a/src/record/mutation.ts +++ b/src/record/mutation.ts @@ -210,7 +210,7 @@ export default class MutationBuffer { return nextId; }; const pushAdd = (n: Node) => { - if (!n.parentNode) { + if (!n.parentNode || !document.contains(n)) { return; } const parentId = mirror.getId((n.parentNode as Node) as INode);