humanbehavior-js 0.4.24 → 0.4.26

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.
File without changes
@@ -37,7 +37,7 @@ var _a;
37
37
  var __defProp$1 = Object.defineProperty;
38
38
  var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
39
39
  var __publicField$1 = (obj, key, value) => __defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
40
- var NodeType$3 = /* @__PURE__ */ ((NodeType2) => {
40
+ var NodeType$2 = /* @__PURE__ */ ((NodeType2) => {
41
41
  NodeType2[NodeType2["Document"] = 0] = "Document";
42
42
  NodeType2[NodeType2["DocumentType"] = 1] = "DocumentType";
43
43
  NodeType2[NodeType2["Element"] = 2] = "Element";
@@ -45,7 +45,7 @@ var NodeType$3 = /* @__PURE__ */ ((NodeType2) => {
45
45
  NodeType2[NodeType2["CDATA"] = 4] = "CDATA";
46
46
  NodeType2[NodeType2["Comment"] = 5] = "Comment";
47
47
  return NodeType2;
48
- })(NodeType$3 || {});
48
+ })(NodeType$2 || {});
49
49
  const testableAccessors$1 = {
50
50
  Node: ["childNodes", "parentNode", "parentElement", "textContent"],
51
51
  ShadowRoot: ["host", "styleSheets"],
@@ -59,9 +59,6 @@ const testableMethods$1 = {
59
59
  MutationObserver: ["constructor"]
60
60
  };
61
61
  const untaintedBasePrototype$1 = {};
62
- const isAngularZonePresent$1 = () => {
63
- return !!globalThis.Zone;
64
- };
65
62
  function getUntaintedPrototype$1(key) {
66
63
  if (untaintedBasePrototype$1[key])
67
64
  return untaintedBasePrototype$1[key];
@@ -89,7 +86,7 @@ function getUntaintedPrototype$1(key) {
89
86
  }
90
87
  )
91
88
  );
92
- if (isUntaintedAccessors && isUntaintedMethods && !isAngularZonePresent$1()) {
89
+ if (isUntaintedAccessors && isUntaintedMethods) {
93
90
  untaintedBasePrototype$1[key] = defaultObj.prototype;
94
91
  return defaultObj.prototype;
95
92
  }
@@ -236,13 +233,9 @@ function stringifyStylesheet(s2) {
236
233
  if (!rules2) {
237
234
  return null;
238
235
  }
239
- let sheetHref = s2.href;
240
- if (!sheetHref && s2.ownerNode && s2.ownerNode.ownerDocument) {
241
- sheetHref = s2.ownerNode.ownerDocument.location.href;
242
- }
243
236
  const stringifiedRules = Array.from(
244
237
  rules2,
245
- (rule2) => stringifyRule(rule2, sheetHref)
238
+ (rule2) => stringifyRule(rule2, s2.href)
246
239
  ).join("");
247
240
  return fixBrowserCompatibilityIssuesInCSS(stringifiedRules);
248
241
  } catch (error) {
@@ -455,40 +448,6 @@ function absolutifyURLs(cssText, href) {
455
448
  }
456
449
  );
457
450
  }
458
- function normalizeCssString(cssText) {
459
- return cssText.replace(/(\/\*[^*]*\*\/)|[\s;]/g, "");
460
- }
461
- function splitCssText(cssText, style) {
462
- const childNodes2 = Array.from(style.childNodes);
463
- const splits = [];
464
- if (childNodes2.length > 1 && cssText && typeof cssText === "string") {
465
- const cssTextNorm = normalizeCssString(cssText);
466
- for (let i2 = 1; i2 < childNodes2.length; i2++) {
467
- if (childNodes2[i2].textContent && typeof childNodes2[i2].textContent === "string") {
468
- const textContentNorm = normalizeCssString(childNodes2[i2].textContent);
469
- for (let j = 3; j < textContentNorm.length; j++) {
470
- const bit = textContentNorm.substring(0, j);
471
- if (cssTextNorm.split(bit).length === 2) {
472
- const splitNorm = cssTextNorm.indexOf(bit);
473
- for (let k = splitNorm; k < cssText.length; k++) {
474
- if (normalizeCssString(cssText.substring(0, k)).length === splitNorm) {
475
- splits.push(cssText.substring(0, k));
476
- cssText = cssText.substring(k);
477
- break;
478
- }
479
- }
480
- break;
481
- }
482
- }
483
- }
484
- }
485
- }
486
- splits.push(cssText);
487
- return splits;
488
- }
489
- function markCssSplits(cssText, style) {
490
- return splitCssText(cssText, style).join("/* rr_split */");
491
- }
492
451
  let _id = 1;
493
452
  const tagNameRegex = new RegExp("[^a-z0-9-_:]");
494
453
  const IGNORED_NODE = -2;
@@ -747,28 +706,27 @@ function serializeNode(n2, options) {
747
706
  inlineImages,
748
707
  recordCanvas,
749
708
  keepIframeSrcFn,
750
- newlyAddedElement = false,
751
- cssCaptured = false
709
+ newlyAddedElement = false
752
710
  } = options;
753
711
  const rootId = getRootId(doc, mirror2);
754
712
  switch (n2.nodeType) {
755
713
  case n2.DOCUMENT_NODE:
756
714
  if (n2.compatMode !== "CSS1Compat") {
757
715
  return {
758
- type: NodeType$3.Document,
716
+ type: NodeType$2.Document,
759
717
  childNodes: [],
760
718
  compatMode: n2.compatMode
761
719
  // probably "BackCompat"
762
720
  };
763
721
  } else {
764
722
  return {
765
- type: NodeType$3.Document,
723
+ type: NodeType$2.Document,
766
724
  childNodes: []
767
725
  };
768
726
  }
769
727
  case n2.DOCUMENT_TYPE_NODE:
770
728
  return {
771
- type: NodeType$3.DocumentType,
729
+ type: NodeType$2.DocumentType,
772
730
  name: n2.name,
773
731
  publicId: n2.publicId,
774
732
  systemId: n2.systemId,
@@ -794,18 +752,17 @@ function serializeNode(n2, options) {
794
752
  doc,
795
753
  needsMask,
796
754
  maskTextFn,
797
- rootId,
798
- cssCaptured
755
+ rootId
799
756
  });
800
757
  case n2.CDATA_SECTION_NODE:
801
758
  return {
802
- type: NodeType$3.CDATA,
759
+ type: NodeType$2.CDATA,
803
760
  textContent: "",
804
761
  rootId
805
762
  };
806
763
  case n2.COMMENT_NODE:
807
764
  return {
808
- type: NodeType$3.Comment,
765
+ type: NodeType$2.Comment,
809
766
  textContent: index$1.textContent(n2) || "",
810
767
  rootId
811
768
  };
@@ -819,26 +776,37 @@ function getRootId(doc, mirror2) {
819
776
  return docId === 1 ? void 0 : docId;
820
777
  }
821
778
  function serializeTextNode(n2, options) {
822
- const { needsMask, maskTextFn, rootId, cssCaptured } = options;
779
+ var _a2;
780
+ const { needsMask, maskTextFn, rootId } = options;
823
781
  const parent = index$1.parentNode(n2);
824
782
  const parentTagName = parent && parent.tagName;
825
- let textContent2 = "";
783
+ let text = index$1.textContent(n2);
826
784
  const isStyle = parentTagName === "STYLE" ? true : void 0;
827
785
  const isScript = parentTagName === "SCRIPT" ? true : void 0;
828
- if (isScript) {
829
- textContent2 = "SCRIPT_PLACEHOLDER";
830
- } else if (!cssCaptured) {
831
- textContent2 = index$1.textContent(n2);
832
- if (isStyle && textContent2) {
833
- textContent2 = absolutifyURLs(textContent2, getHref(options.doc));
786
+ if (isStyle && text) {
787
+ try {
788
+ if (n2.nextSibling || n2.previousSibling) {
789
+ } else if ((_a2 = parent.sheet) == null ? void 0 : _a2.cssRules) {
790
+ text = stringifyStylesheet(parent.sheet);
791
+ }
792
+ } catch (err) {
793
+ console.warn(
794
+ `Cannot get CSS styles from text's parentNode. Error: ${err}`,
795
+ n2
796
+ );
834
797
  }
798
+ text = absolutifyURLs(text, getHref(options.doc));
835
799
  }
836
- if (!isStyle && !isScript && textContent2 && needsMask) {
837
- textContent2 = maskTextFn ? maskTextFn(textContent2, index$1.parentElement(n2)) : textContent2.replace(/[\S]/g, "*");
800
+ if (isScript) {
801
+ text = "SCRIPT_PLACEHOLDER";
802
+ }
803
+ if (!isStyle && !isScript && text && needsMask) {
804
+ text = maskTextFn ? maskTextFn(text, index$1.parentElement(n2)) : text.replace(/[\S]/g, "*");
838
805
  }
839
806
  return {
840
- type: NodeType$3.Text,
841
- textContent: textContent2 || "",
807
+ type: NodeType$2.Text,
808
+ textContent: text || "",
809
+ isStyle,
842
810
  rootId
843
811
  };
844
812
  }
@@ -886,14 +854,12 @@ function serializeElementNode(n2, options) {
886
854
  attributes._cssText = cssText;
887
855
  }
888
856
  }
889
- if (tagName === "style" && n2.sheet) {
890
- let cssText = stringifyStylesheet(
857
+ if (tagName === "style" && n2.sheet && // TODO: Currently we only try to get dynamic stylesheet when it is an empty style element
858
+ !(n2.innerText || index$1.textContent(n2) || "").trim().length) {
859
+ const cssText = stringifyStylesheet(
891
860
  n2.sheet
892
861
  );
893
862
  if (cssText) {
894
- if (n2.childNodes.length > 1) {
895
- cssText = markCssSplits(cssText, n2);
896
- }
897
863
  attributes._cssText = cssText;
898
864
  }
899
865
  }
@@ -1023,7 +989,7 @@ function serializeElementNode(n2, options) {
1023
989
  } catch (e2) {
1024
990
  }
1025
991
  return {
1026
- type: NodeType$3.Element,
992
+ type: NodeType$2.Element,
1027
993
  tagName,
1028
994
  attributes,
1029
995
  childNodes: [],
@@ -1041,9 +1007,9 @@ function lowerIfExists(maybeAttr) {
1041
1007
  }
1042
1008
  }
1043
1009
  function slimDOMExcluded(sn, slimDOMOptions) {
1044
- if (slimDOMOptions.comment && sn.type === NodeType$3.Comment) {
1010
+ if (slimDOMOptions.comment && sn.type === NodeType$2.Comment) {
1045
1011
  return true;
1046
- } else if (sn.type === NodeType$3.Element) {
1012
+ } else if (sn.type === NodeType$2.Element) {
1047
1013
  if (slimDOMOptions.script && // script tag
1048
1014
  (sn.tagName === "script" || // (module)preload link
1049
1015
  sn.tagName === "link" && (sn.attributes.rel === "preload" || sn.attributes.rel === "modulepreload") && sn.attributes.as === "script" || // prefetch link
@@ -1095,8 +1061,7 @@ function serializeNodeWithId(n2, options) {
1095
1061
  onStylesheetLoad,
1096
1062
  stylesheetLoadTimeout = 5e3,
1097
1063
  keepIframeSrcFn = () => false,
1098
- newlyAddedElement = false,
1099
- cssCaptured = false
1064
+ newlyAddedElement = false
1100
1065
  } = options;
1101
1066
  let { needsMask } = options;
1102
1067
  let { preserveWhiteSpace = true } = options;
@@ -1123,8 +1088,7 @@ function serializeNodeWithId(n2, options) {
1123
1088
  inlineImages,
1124
1089
  recordCanvas,
1125
1090
  keepIframeSrcFn,
1126
- newlyAddedElement,
1127
- cssCaptured
1091
+ newlyAddedElement
1128
1092
  });
1129
1093
  if (!_serializedNode) {
1130
1094
  console.warn(n2, "not serialized");
@@ -1133,7 +1097,7 @@ function serializeNodeWithId(n2, options) {
1133
1097
  let id;
1134
1098
  if (mirror2.hasNode(n2)) {
1135
1099
  id = mirror2.getId(n2);
1136
- } else if (slimDOMExcluded(_serializedNode, slimDOMOptions) || !preserveWhiteSpace && _serializedNode.type === NodeType$3.Text && !_serializedNode.textContent.replace(/^\s+|\s+$/gm, "").length) {
1100
+ } else if (slimDOMExcluded(_serializedNode, slimDOMOptions) || !preserveWhiteSpace && _serializedNode.type === NodeType$2.Text && !_serializedNode.isStyle && !_serializedNode.textContent.replace(/^\s+|\s+$/gm, "").length) {
1137
1101
  id = IGNORED_NODE;
1138
1102
  } else {
1139
1103
  id = genId();
@@ -1147,15 +1111,15 @@ function serializeNodeWithId(n2, options) {
1147
1111
  onSerialize(n2);
1148
1112
  }
1149
1113
  let recordChild = !skipChild;
1150
- if (serializedNode.type === NodeType$3.Element) {
1114
+ if (serializedNode.type === NodeType$2.Element) {
1151
1115
  recordChild = recordChild && !serializedNode.needBlock;
1152
1116
  delete serializedNode.needBlock;
1153
1117
  const shadowRootEl = index$1.shadowRoot(n2);
1154
1118
  if (shadowRootEl && isNativeShadowDom(shadowRootEl))
1155
1119
  serializedNode.isShadowHost = true;
1156
1120
  }
1157
- if ((serializedNode.type === NodeType$3.Document || serializedNode.type === NodeType$3.Element) && recordChild) {
1158
- if (slimDOMOptions.headWhitespace && serializedNode.type === NodeType$3.Element && serializedNode.tagName === "head") {
1121
+ if ((serializedNode.type === NodeType$2.Document || serializedNode.type === NodeType$2.Element) && recordChild) {
1122
+ if (slimDOMOptions.headWhitespace && serializedNode.type === NodeType$2.Element && serializedNode.tagName === "head") {
1159
1123
  preserveWhiteSpace = false;
1160
1124
  }
1161
1125
  const bypassOptions = {
@@ -1181,14 +1145,10 @@ function serializeNodeWithId(n2, options) {
1181
1145
  iframeLoadTimeout,
1182
1146
  onStylesheetLoad,
1183
1147
  stylesheetLoadTimeout,
1184
- keepIframeSrcFn,
1185
- cssCaptured: false
1148
+ keepIframeSrcFn
1186
1149
  };
1187
- if (serializedNode.type === NodeType$3.Element && serializedNode.tagName === "textarea" && serializedNode.attributes.value !== void 0) ;
1150
+ if (serializedNode.type === NodeType$2.Element && serializedNode.tagName === "textarea" && serializedNode.attributes.value !== void 0) ;
1188
1151
  else {
1189
- if (serializedNode.type === NodeType$3.Element && serializedNode.attributes._cssText !== void 0 && typeof serializedNode.attributes._cssText === "string") {
1190
- bypassOptions.cssCaptured = true;
1191
- }
1192
1152
  for (const childN of Array.from(index$1.childNodes(n2))) {
1193
1153
  const serializedChildNode = serializeNodeWithId(childN, bypassOptions);
1194
1154
  if (serializedChildNode) {
@@ -1211,7 +1171,7 @@ function serializeNodeWithId(n2, options) {
1211
1171
  if (parent && isShadowRoot(parent) && isNativeShadowDom(parent)) {
1212
1172
  serializedNode.isShadow = true;
1213
1173
  }
1214
- if (serializedNode.type === NodeType$3.Element && serializedNode.tagName === "iframe") {
1174
+ if (serializedNode.type === NodeType$2.Element && serializedNode.tagName === "iframe") {
1215
1175
  onceIframeLoaded(
1216
1176
  n2,
1217
1177
  () => {
@@ -1253,7 +1213,7 @@ function serializeNodeWithId(n2, options) {
1253
1213
  iframeLoadTimeout
1254
1214
  );
1255
1215
  }
1256
- if (serializedNode.type === NodeType$3.Element && serializedNode.tagName === "link" && typeof serializedNode.attributes.rel === "string" && (serializedNode.attributes.rel === "stylesheet" || serializedNode.attributes.rel === "preload" && typeof serializedNode.attributes.href === "string" && extractFileExtension(serializedNode.attributes.href) === "css")) {
1216
+ if (serializedNode.type === NodeType$2.Element && serializedNode.tagName === "link" && typeof serializedNode.attributes.rel === "string" && (serializedNode.attributes.rel === "stylesheet" || serializedNode.attributes.rel === "preload" && typeof serializedNode.attributes.href === "string" && extractFileExtension(serializedNode.attributes.href) === "css")) {
1257
1217
  onceStylesheetLoaded(
1258
1218
  n2,
1259
1219
  () => {
@@ -8532,9 +8492,6 @@ const testableMethods = {
8532
8492
  MutationObserver: ["constructor"]
8533
8493
  };
8534
8494
  const untaintedBasePrototype = {};
8535
- const isAngularZonePresent = () => {
8536
- return !!globalThis.Zone;
8537
- };
8538
8495
  function getUntaintedPrototype(key) {
8539
8496
  if (untaintedBasePrototype[key])
8540
8497
  return untaintedBasePrototype[key];
@@ -8562,7 +8519,7 @@ function getUntaintedPrototype(key) {
8562
8519
  }
8563
8520
  )
8564
8521
  );
8565
- if (isUntaintedAccessors && isUntaintedMethods && !isAngularZonePresent()) {
8522
+ if (isUntaintedAccessors && isUntaintedMethods) {
8566
8523
  untaintedBasePrototype[key] = defaultObj.prototype;
8567
8524
  return defaultObj.prototype;
8568
8525
  }
@@ -8994,15 +8951,6 @@ var MediaInteractions = /* @__PURE__ */ ((MediaInteractions2) => {
8994
8951
  MediaInteractions2[MediaInteractions2["RateChange"] = 4] = "RateChange";
8995
8952
  return MediaInteractions2;
8996
8953
  })(MediaInteractions || {});
8997
- var NodeType = /* @__PURE__ */ ((NodeType2) => {
8998
- NodeType2[NodeType2["Document"] = 0] = "Document";
8999
- NodeType2[NodeType2["DocumentType"] = 1] = "DocumentType";
9000
- NodeType2[NodeType2["Element"] = 2] = "Element";
9001
- NodeType2[NodeType2["Text"] = 3] = "Text";
9002
- NodeType2[NodeType2["CDATA"] = 4] = "CDATA";
9003
- NodeType2[NodeType2["Comment"] = 5] = "Comment";
9004
- return NodeType2;
9005
- })(NodeType || {});
9006
8954
  function isNodeInLinkedList(n2) {
9007
8955
  return "__ln" in n2;
9008
8956
  }
@@ -9097,7 +9045,6 @@ class MutationBuffer {
9097
9045
  __publicField(this, "addedSet", /* @__PURE__ */ new Set());
9098
9046
  __publicField(this, "movedSet", /* @__PURE__ */ new Set());
9099
9047
  __publicField(this, "droppedSet", /* @__PURE__ */ new Set());
9100
- __publicField(this, "removesSubTreeCache", /* @__PURE__ */ new Set());
9101
9048
  __publicField(this, "mutationCb");
9102
9049
  __publicField(this, "blockClass");
9103
9050
  __publicField(this, "blockSelector");
@@ -9142,18 +9089,9 @@ class MutationBuffer {
9142
9089
  };
9143
9090
  const pushAdd = (n2) => {
9144
9091
  const parent = index.parentNode(n2);
9145
- if (!parent || !inDom(n2)) {
9092
+ if (!parent || !inDom(n2) || parent.tagName === "TEXTAREA") {
9146
9093
  return;
9147
9094
  }
9148
- let cssCaptured = false;
9149
- if (n2.nodeType === Node.TEXT_NODE) {
9150
- const parentTag = parent.tagName;
9151
- if (parentTag === "TEXTAREA") {
9152
- return;
9153
- } else if (parentTag === "STYLE" && this.addedSet.has(parent)) {
9154
- cssCaptured = true;
9155
- }
9156
- }
9157
9095
  const parentId = isShadowRoot(parent) ? this.mirror.getId(getShadowHost(n2)) : this.mirror.getId(parent);
9158
9096
  const nextId = getNextId(n2);
9159
9097
  if (parentId === -1 || nextId === -1) {
@@ -9195,8 +9133,7 @@ class MutationBuffer {
9195
9133
  },
9196
9134
  onStylesheetLoad: (link, childSn) => {
9197
9135
  this.stylesheetManager.attachLinkElement(link, childSn);
9198
- },
9199
- cssCaptured
9136
+ }
9200
9137
  });
9201
9138
  if (sn) {
9202
9139
  adds.push({
@@ -9211,13 +9148,13 @@ class MutationBuffer {
9211
9148
  this.mirror.removeNodeFromMap(this.mapRemoves.shift());
9212
9149
  }
9213
9150
  for (const n2 of this.movedSet) {
9214
- if (isParentRemoved(this.removesSubTreeCache, n2, this.mirror) && !this.movedSet.has(index.parentNode(n2))) {
9151
+ if (isParentRemoved(this.removes, n2, this.mirror) && !this.movedSet.has(index.parentNode(n2))) {
9215
9152
  continue;
9216
9153
  }
9217
9154
  pushAdd(n2);
9218
9155
  }
9219
9156
  for (const n2 of this.addedSet) {
9220
- if (!isAncestorInSet(this.droppedSet, n2) && !isParentRemoved(this.removesSubTreeCache, n2, this.mirror)) {
9157
+ if (!isAncestorInSet(this.droppedSet, n2) && !isParentRemoved(this.removes, n2, this.mirror)) {
9221
9158
  pushAdd(n2);
9222
9159
  } else if (isAncestorInSet(this.movedSet, n2)) {
9223
9160
  pushAdd(n2);
@@ -9313,7 +9250,6 @@ class MutationBuffer {
9313
9250
  this.addedSet = /* @__PURE__ */ new Set();
9314
9251
  this.movedSet = /* @__PURE__ */ new Set();
9315
9252
  this.droppedSet = /* @__PURE__ */ new Set();
9316
- this.removesSubTreeCache = /* @__PURE__ */ new Set();
9317
9253
  this.movedMap = {};
9318
9254
  this.mutationCb(payload);
9319
9255
  });
@@ -9468,7 +9404,6 @@ class MutationBuffer {
9468
9404
  id: nodeId,
9469
9405
  isShadow: isShadowRoot(m.target) && isNativeShadowDom(m.target) ? true : void 0
9470
9406
  });
9471
- processRemoves(n2, this.removesSubTreeCache);
9472
9407
  }
9473
9408
  this.mapRemoves.push(n2);
9474
9409
  });
@@ -9563,24 +9498,20 @@ function deepDelete(addsSet, n2) {
9563
9498
  addsSet.delete(n2);
9564
9499
  index.childNodes(n2).forEach((childN) => deepDelete(addsSet, childN));
9565
9500
  }
9566
- function processRemoves(n2, cache) {
9567
- const queue = [n2];
9568
- while (queue.length) {
9569
- const next = queue.pop();
9570
- if (cache.has(next)) continue;
9571
- cache.add(next);
9572
- index.childNodes(next).forEach((n22) => queue.push(n22));
9573
- }
9574
- return;
9575
- }
9576
9501
  function isParentRemoved(removes, n2, mirror2) {
9577
- if (removes.size === 0) return false;
9578
- return _isParentRemoved(removes, n2);
9579
- }
9580
- function _isParentRemoved(removes, n2, _mirror2) {
9581
- const node2 = index.parentNode(n2);
9582
- if (!node2) return false;
9583
- return removes.has(node2);
9502
+ if (removes.length === 0) return false;
9503
+ return _isParentRemoved(removes, n2, mirror2);
9504
+ }
9505
+ function _isParentRemoved(removes, n2, mirror2) {
9506
+ let node2 = index.parentNode(n2);
9507
+ while (node2) {
9508
+ const parentId = mirror2.getId(node2);
9509
+ if (removes.some((r2) => r2.id === parentId)) {
9510
+ return true;
9511
+ }
9512
+ node2 = index.parentNode(node2);
9513
+ }
9514
+ return false;
9584
9515
  }
9585
9516
  function isAncestorInSet(set, n2) {
9586
9517
  if (set.size === 0) return false;
@@ -10918,7 +10849,7 @@ class IframeManager {
10918
10849
  }
10919
10850
  }
10920
10851
  patchRootIdOnNode(node2, rootId) {
10921
- if (node2.type !== NodeType.Document && !node2.rootId) node2.rootId = rootId;
10852
+ if (node2.type !== NodeType$2.Document && !node2.rootId) node2.rootId = rootId;
10922
10853
  if ("childNodes" in node2) {
10923
10854
  node2.childNodes.forEach((child) => {
10924
10855
  this.patchRootIdOnNode(child, rootId);