@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.
@@ -5684,17 +5684,22 @@ function buildNodeWithSN(n2, options) {
5684
5684
  mirror2.replace(n2.rootId, doc);
5685
5685
  }
5686
5686
  if (n2.type === NodeType$3.Document) {
5687
- doc.close();
5688
- doc.open();
5689
- if (n2.compatMode === "BackCompat" && n2.childNodes && n2.childNodes[0].type !== NodeType$3.DocumentType) {
5690
- 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") {
5691
- doc.write(
5692
- '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">'
5693
- );
5694
- } else {
5695
- doc.write(
5696
- '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "">'
5697
- );
5687
+ const quirks = n2.compatMode === "BackCompat" && n2.childNodes && n2.childNodes[0].type !== NodeType$3.DocumentType;
5688
+ if (doc.compatMode === (quirks ? "BackCompat" : "CSS1Compat")) {
5689
+ while (doc.firstChild) doc.removeChild(doc.firstChild);
5690
+ } else {
5691
+ doc.close();
5692
+ doc.open();
5693
+ if (quirks) {
5694
+ 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") {
5695
+ doc.write(
5696
+ '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">'
5697
+ );
5698
+ } else {
5699
+ doc.write(
5700
+ '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "">'
5701
+ );
5702
+ }
5698
5703
  }
5699
5704
  }
5700
5705
  node2 = doc;