protect against no parent node (#1445)

* protect against a missing parent node during a mutation on an textNode
This commit is contained in:
David Newell
2026-04-01 12:00:00 +08:00
committed by GitHub
parent 8a93739766
commit 5956f9b4aa
2 changed files with 9 additions and 1 deletions

View File

@@ -0,0 +1,5 @@
---
'rrweb': patch
---
fix: protect against missing parentNode

View File

@@ -441,7 +441,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);
}