Skip to content

Commit 5e04833

Browse files
authored
fix: do not throw on empty cdata
1 parent 4db9782 commit 5e04833

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

packages/rrweb-snapshot/src/rebuild.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,9 @@ function buildNode(
432432
}
433433
return doc.createTextNode(n.textContent);
434434
case NodeType.CDATA:
435+
if (n.textContent.trim() === '') {
436+
return null;
437+
}
435438
return doc.createCDATASection(n.textContent);
436439
case NodeType.Comment:
437440
return doc.createComment(n.textContent);

0 commit comments

Comments
 (0)