Skip to content

Commit

Permalink
protect against no parent node (#1445)
Browse files Browse the repository at this point in the history
* protect against a missing parent node during a mutation on an textNode
  • Loading branch information
daibhin authored Apr 10, 2024
1 parent 3d1877c commit 02f50d2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/three-baboons-bow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'rrweb': patch
---

fix: protect against missing parentNode
5 changes: 4 additions & 1 deletion packages/rrweb/src/record/mutation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 02f50d2

Please sign in to comment.