@screeb/rrweb 2.1.6-screeb.1 → 2.1.6-screeb.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/rrweb.cjs CHANGED
@@ -5639,17 +5639,22 @@ function buildNodeWithSN(n2, options) {
5639
5639
  mirror2.replace(n2.rootId, doc);
5640
5640
  }
5641
5641
  if (n2.type === NodeType$3.Document) {
5642
- doc.close();
5643
- doc.open();
5644
- if (n2.compatMode === "BackCompat" && n2.childNodes && n2.childNodes[0].type !== NodeType$3.DocumentType) {
5645
- if (n2.childNodes[0].type === NodeType$3.Element && "xmlns" in n2.childNodes[0].attributes && n2.childNodes[0].attributes.xmlns === "http://www.w3.org/1999/xhtml") {
5646
- doc.write(
5647
- '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">'
5648
- );
5649
- } else {
5650
- doc.write(
5651
- '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "">'
5652
- );
5642
+ const quirks = n2.compatMode === "BackCompat" && n2.childNodes && n2.childNodes[0].type !== NodeType$3.DocumentType;
5643
+ if (doc.compatMode === (quirks ? "BackCompat" : "CSS1Compat")) {
5644
+ while (doc.firstChild) doc.removeChild(doc.firstChild);
5645
+ } else {
5646
+ doc.close();
5647
+ doc.open();
5648
+ if (quirks) {
5649
+ if (n2.childNodes[0].type === NodeType$3.Element && "xmlns" in n2.childNodes[0].attributes && n2.childNodes[0].attributes.xmlns === "http://www.w3.org/1999/xhtml") {
5650
+ doc.write(
5651
+ '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">'
5652
+ );
5653
+ } else {
5654
+ doc.write(
5655
+ '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "">'
5656
+ );
5657
+ }
5653
5658
  }
5654
5659
  }
5655
5660
  node2 = doc;