@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.js CHANGED
@@ -5637,17 +5637,22 @@ function buildNodeWithSN(n2, options) {
5637
5637
  mirror2.replace(n2.rootId, doc);
5638
5638
  }
5639
5639
  if (n2.type === NodeType$3.Document) {
5640
- doc.close();
5641
- doc.open();
5642
- if (n2.compatMode === "BackCompat" && n2.childNodes && n2.childNodes[0].type !== NodeType$3.DocumentType) {
5643
- 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") {
5644
- doc.write(
5645
- '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">'
5646
- );
5647
- } else {
5648
- doc.write(
5649
- '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "">'
5650
- );
5640
+ const quirks = n2.compatMode === "BackCompat" && n2.childNodes && n2.childNodes[0].type !== NodeType$3.DocumentType;
5641
+ if (doc.compatMode === (quirks ? "BackCompat" : "CSS1Compat")) {
5642
+ while (doc.firstChild) doc.removeChild(doc.firstChild);
5643
+ } else {
5644
+ doc.close();
5645
+ doc.open();
5646
+ if (quirks) {
5647
+ 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") {
5648
+ doc.write(
5649
+ '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">'
5650
+ );
5651
+ } else {
5652
+ doc.write(
5653
+ '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "">'
5654
+ );
5655
+ }
5651
5656
  }
5652
5657
  }
5653
5658
  node2 = doc;