diff --git a/packages/rrweb/src/record/mutation.ts b/packages/rrweb/src/record/mutation.ts index e6d686af54..02b1e0bb5b 100644 --- a/packages/rrweb/src/record/mutation.ts +++ b/packages/rrweb/src/record/mutation.ts @@ -440,7 +440,10 @@ export default class MutationBuffer { texts: this.texts .map((text) => { const n = text.node; - if ((n.parentNode as Element).tagName === 'TEXTAREA') { + if ( + n.parentNode && + (n.parentNode as Element).tagName === 'TEXTAREA' + ) { // the node is being ignored as it isn't in the mirror, so shift mutation to attributes on parent textarea this.genTextAreaValueMutation(n.parentNode as HTMLTextAreaElement); }