protect against no parent node (#1445)
* protect against a missing parent node during a mutation on an textNode
This commit is contained in:
5
.changeset/three-baboons-bow.md
Normal file
5
.changeset/three-baboons-bow.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'rrweb': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
fix: protect against missing parentNode
|
||||||
@@ -441,7 +441,10 @@ export default class MutationBuffer {
|
|||||||
texts: this.texts
|
texts: this.texts
|
||||||
.map((text) => {
|
.map((text) => {
|
||||||
const n = text.node;
|
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
|
// 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);
|
this.genTextAreaValueMutation(n.parentNode as HTMLTextAreaElement);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user