humanbehavior-js 0.4.25 → 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.
@@ -41,7 +41,7 @@ var _a;
41
41
  var __defProp$1 = Object.defineProperty;
42
42
  var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
43
43
  var __publicField$1 = (obj, key, value) => __defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
44
- var NodeType$3 = /* @__PURE__ */ ((NodeType2) => {
44
+ var NodeType$2 = /* @__PURE__ */ ((NodeType2) => {
45
45
  NodeType2[NodeType2["Document"] = 0] = "Document";
46
46
  NodeType2[NodeType2["DocumentType"] = 1] = "DocumentType";
47
47
  NodeType2[NodeType2["Element"] = 2] = "Element";
@@ -49,7 +49,7 @@ var NodeType$3 = /* @__PURE__ */ ((NodeType2) => {
49
49
  NodeType2[NodeType2["CDATA"] = 4] = "CDATA";
50
50
  NodeType2[NodeType2["Comment"] = 5] = "Comment";
51
51
  return NodeType2;
52
- })(NodeType$3 || {});
52
+ })(NodeType$2 || {});
53
53
  const testableAccessors$1 = {
54
54
  Node: ["childNodes", "parentNode", "parentElement", "textContent"],
55
55
  ShadowRoot: ["host", "styleSheets"],
@@ -63,9 +63,6 @@ const testableMethods$1 = {
63
63
  MutationObserver: ["constructor"]
64
64
  };
65
65
  const untaintedBasePrototype$1 = {};
66
- const isAngularZonePresent$1 = () => {
67
- return !!globalThis.Zone;
68
- };
69
66
  function getUntaintedPrototype$1(key) {
70
67
  if (untaintedBasePrototype$1[key])
71
68
  return untaintedBasePrototype$1[key];
@@ -93,7 +90,7 @@ function getUntaintedPrototype$1(key) {
93
90
  }
94
91
  )
95
92
  );
96
- if (isUntaintedAccessors && isUntaintedMethods && !isAngularZonePresent$1()) {
93
+ if (isUntaintedAccessors && isUntaintedMethods) {
97
94
  untaintedBasePrototype$1[key] = defaultObj.prototype;
98
95
  return defaultObj.prototype;
99
96
  }
@@ -240,13 +237,9 @@ function stringifyStylesheet(s2) {
240
237
  if (!rules2) {
241
238
  return null;
242
239
  }
243
- let sheetHref = s2.href;
244
- if (!sheetHref && s2.ownerNode && s2.ownerNode.ownerDocument) {
245
- sheetHref = s2.ownerNode.ownerDocument.location.href;
246
- }
247
240
  const stringifiedRules = Array.from(
248
241
  rules2,
249
- (rule2) => stringifyRule(rule2, sheetHref)
242
+ (rule2) => stringifyRule(rule2, s2.href)
250
243
  ).join("");
251
244
  return fixBrowserCompatibilityIssuesInCSS(stringifiedRules);
252
245
  } catch (error) {
@@ -459,40 +452,6 @@ function absolutifyURLs(cssText, href) {
459
452
  }
460
453
  );
461
454
  }
462
- function normalizeCssString(cssText) {
463
- return cssText.replace(/(\/\*[^*]*\*\/)|[\s;]/g, "");
464
- }
465
- function splitCssText(cssText, style) {
466
- const childNodes2 = Array.from(style.childNodes);
467
- const splits = [];
468
- if (childNodes2.length > 1 && cssText && typeof cssText === "string") {
469
- const cssTextNorm = normalizeCssString(cssText);
470
- for (let i2 = 1; i2 < childNodes2.length; i2++) {
471
- if (childNodes2[i2].textContent && typeof childNodes2[i2].textContent === "string") {
472
- const textContentNorm = normalizeCssString(childNodes2[i2].textContent);
473
- for (let j = 3; j < textContentNorm.length; j++) {
474
- const bit = textContentNorm.substring(0, j);
475
- if (cssTextNorm.split(bit).length === 2) {
476
- const splitNorm = cssTextNorm.indexOf(bit);
477
- for (let k = splitNorm; k < cssText.length; k++) {
478
- if (normalizeCssString(cssText.substring(0, k)).length === splitNorm) {
479
- splits.push(cssText.substring(0, k));
480
- cssText = cssText.substring(k);
481
- break;
482
- }
483
- }
484
- break;
485
- }
486
- }
487
- }
488
- }
489
- }
490
- splits.push(cssText);
491
- return splits;
492
- }
493
- function markCssSplits(cssText, style) {
494
- return splitCssText(cssText, style).join("/* rr_split */");
495
- }
496
455
  let _id = 1;
497
456
  const tagNameRegex = new RegExp("[^a-z0-9-_:]");
498
457
  const IGNORED_NODE = -2;
@@ -751,28 +710,27 @@ function serializeNode(n2, options) {
751
710
  inlineImages,
752
711
  recordCanvas,
753
712
  keepIframeSrcFn,
754
- newlyAddedElement = false,
755
- cssCaptured = false
713
+ newlyAddedElement = false
756
714
  } = options;
757
715
  const rootId = getRootId(doc, mirror2);
758
716
  switch (n2.nodeType) {
759
717
  case n2.DOCUMENT_NODE:
760
718
  if (n2.compatMode !== "CSS1Compat") {
761
719
  return {
762
- type: NodeType$3.Document,
720
+ type: NodeType$2.Document,
763
721
  childNodes: [],
764
722
  compatMode: n2.compatMode
765
723
  // probably "BackCompat"
766
724
  };
767
725
  } else {
768
726
  return {
769
- type: NodeType$3.Document,
727
+ type: NodeType$2.Document,
770
728
  childNodes: []
771
729
  };
772
730
  }
773
731
  case n2.DOCUMENT_TYPE_NODE:
774
732
  return {
775
- type: NodeType$3.DocumentType,
733
+ type: NodeType$2.DocumentType,
776
734
  name: n2.name,
777
735
  publicId: n2.publicId,
778
736
  systemId: n2.systemId,
@@ -798,18 +756,17 @@ function serializeNode(n2, options) {
798
756
  doc,
799
757
  needsMask,
800
758
  maskTextFn,
801
- rootId,
802
- cssCaptured
759
+ rootId
803
760
  });
804
761
  case n2.CDATA_SECTION_NODE:
805
762
  return {
806
- type: NodeType$3.CDATA,
763
+ type: NodeType$2.CDATA,
807
764
  textContent: "",
808
765
  rootId
809
766
  };
810
767
  case n2.COMMENT_NODE:
811
768
  return {
812
- type: NodeType$3.Comment,
769
+ type: NodeType$2.Comment,
813
770
  textContent: index$1.textContent(n2) || "",
814
771
  rootId
815
772
  };
@@ -823,26 +780,37 @@ function getRootId(doc, mirror2) {
823
780
  return docId === 1 ? void 0 : docId;
824
781
  }
825
782
  function serializeTextNode(n2, options) {
826
- const { needsMask, maskTextFn, rootId, cssCaptured } = options;
783
+ var _a2;
784
+ const { needsMask, maskTextFn, rootId } = options;
827
785
  const parent = index$1.parentNode(n2);
828
786
  const parentTagName = parent && parent.tagName;
829
- let textContent2 = "";
787
+ let text = index$1.textContent(n2);
830
788
  const isStyle = parentTagName === "STYLE" ? true : void 0;
831
789
  const isScript = parentTagName === "SCRIPT" ? true : void 0;
832
- if (isScript) {
833
- textContent2 = "SCRIPT_PLACEHOLDER";
834
- } else if (!cssCaptured) {
835
- textContent2 = index$1.textContent(n2);
836
- if (isStyle && textContent2) {
837
- textContent2 = absolutifyURLs(textContent2, getHref(options.doc));
790
+ if (isStyle && text) {
791
+ try {
792
+ if (n2.nextSibling || n2.previousSibling) {
793
+ } else if ((_a2 = parent.sheet) == null ? void 0 : _a2.cssRules) {
794
+ text = stringifyStylesheet(parent.sheet);
795
+ }
796
+ } catch (err) {
797
+ console.warn(
798
+ `Cannot get CSS styles from text's parentNode. Error: ${err}`,
799
+ n2
800
+ );
838
801
  }
802
+ text = absolutifyURLs(text, getHref(options.doc));
839
803
  }
840
- if (!isStyle && !isScript && textContent2 && needsMask) {
841
- textContent2 = maskTextFn ? maskTextFn(textContent2, index$1.parentElement(n2)) : textContent2.replace(/[\S]/g, "*");
804
+ if (isScript) {
805
+ text = "SCRIPT_PLACEHOLDER";
806
+ }
807
+ if (!isStyle && !isScript && text && needsMask) {
808
+ text = maskTextFn ? maskTextFn(text, index$1.parentElement(n2)) : text.replace(/[\S]/g, "*");
842
809
  }
843
810
  return {
844
- type: NodeType$3.Text,
845
- textContent: textContent2 || "",
811
+ type: NodeType$2.Text,
812
+ textContent: text || "",
813
+ isStyle,
846
814
  rootId
847
815
  };
848
816
  }
@@ -890,14 +858,12 @@ function serializeElementNode(n2, options) {
890
858
  attributes._cssText = cssText;
891
859
  }
892
860
  }
893
- if (tagName === "style" && n2.sheet) {
894
- let cssText = stringifyStylesheet(
861
+ if (tagName === "style" && n2.sheet && // TODO: Currently we only try to get dynamic stylesheet when it is an empty style element
862
+ !(n2.innerText || index$1.textContent(n2) || "").trim().length) {
863
+ const cssText = stringifyStylesheet(
895
864
  n2.sheet
896
865
  );
897
866
  if (cssText) {
898
- if (n2.childNodes.length > 1) {
899
- cssText = markCssSplits(cssText, n2);
900
- }
901
867
  attributes._cssText = cssText;
902
868
  }
903
869
  }
@@ -1027,7 +993,7 @@ function serializeElementNode(n2, options) {
1027
993
  } catch (e2) {
1028
994
  }
1029
995
  return {
1030
- type: NodeType$3.Element,
996
+ type: NodeType$2.Element,
1031
997
  tagName,
1032
998
  attributes,
1033
999
  childNodes: [],
@@ -1045,9 +1011,9 @@ function lowerIfExists(maybeAttr) {
1045
1011
  }
1046
1012
  }
1047
1013
  function slimDOMExcluded(sn, slimDOMOptions) {
1048
- if (slimDOMOptions.comment && sn.type === NodeType$3.Comment) {
1014
+ if (slimDOMOptions.comment && sn.type === NodeType$2.Comment) {
1049
1015
  return true;
1050
- } else if (sn.type === NodeType$3.Element) {
1016
+ } else if (sn.type === NodeType$2.Element) {
1051
1017
  if (slimDOMOptions.script && // script tag
1052
1018
  (sn.tagName === "script" || // (module)preload link
1053
1019
  sn.tagName === "link" && (sn.attributes.rel === "preload" || sn.attributes.rel === "modulepreload") && sn.attributes.as === "script" || // prefetch link
@@ -1099,8 +1065,7 @@ function serializeNodeWithId(n2, options) {
1099
1065
  onStylesheetLoad,
1100
1066
  stylesheetLoadTimeout = 5e3,
1101
1067
  keepIframeSrcFn = () => false,
1102
- newlyAddedElement = false,
1103
- cssCaptured = false
1068
+ newlyAddedElement = false
1104
1069
  } = options;
1105
1070
  let { needsMask } = options;
1106
1071
  let { preserveWhiteSpace = true } = options;
@@ -1127,8 +1092,7 @@ function serializeNodeWithId(n2, options) {
1127
1092
  inlineImages,
1128
1093
  recordCanvas,
1129
1094
  keepIframeSrcFn,
1130
- newlyAddedElement,
1131
- cssCaptured
1095
+ newlyAddedElement
1132
1096
  });
1133
1097
  if (!_serializedNode) {
1134
1098
  console.warn(n2, "not serialized");
@@ -1137,7 +1101,7 @@ function serializeNodeWithId(n2, options) {
1137
1101
  let id;
1138
1102
  if (mirror2.hasNode(n2)) {
1139
1103
  id = mirror2.getId(n2);
1140
- } else if (slimDOMExcluded(_serializedNode, slimDOMOptions) || !preserveWhiteSpace && _serializedNode.type === NodeType$3.Text && !_serializedNode.textContent.replace(/^\s+|\s+$/gm, "").length) {
1104
+ } else if (slimDOMExcluded(_serializedNode, slimDOMOptions) || !preserveWhiteSpace && _serializedNode.type === NodeType$2.Text && !_serializedNode.isStyle && !_serializedNode.textContent.replace(/^\s+|\s+$/gm, "").length) {
1141
1105
  id = IGNORED_NODE;
1142
1106
  } else {
1143
1107
  id = genId();
@@ -1151,15 +1115,15 @@ function serializeNodeWithId(n2, options) {
1151
1115
  onSerialize(n2);
1152
1116
  }
1153
1117
  let recordChild = !skipChild;
1154
- if (serializedNode.type === NodeType$3.Element) {
1118
+ if (serializedNode.type === NodeType$2.Element) {
1155
1119
  recordChild = recordChild && !serializedNode.needBlock;
1156
1120
  delete serializedNode.needBlock;
1157
1121
  const shadowRootEl = index$1.shadowRoot(n2);
1158
1122
  if (shadowRootEl && isNativeShadowDom(shadowRootEl))
1159
1123
  serializedNode.isShadowHost = true;
1160
1124
  }
1161
- if ((serializedNode.type === NodeType$3.Document || serializedNode.type === NodeType$3.Element) && recordChild) {
1162
- if (slimDOMOptions.headWhitespace && serializedNode.type === NodeType$3.Element && serializedNode.tagName === "head") {
1125
+ if ((serializedNode.type === NodeType$2.Document || serializedNode.type === NodeType$2.Element) && recordChild) {
1126
+ if (slimDOMOptions.headWhitespace && serializedNode.type === NodeType$2.Element && serializedNode.tagName === "head") {
1163
1127
  preserveWhiteSpace = false;
1164
1128
  }
1165
1129
  const bypassOptions = {
@@ -1185,14 +1149,10 @@ function serializeNodeWithId(n2, options) {
1185
1149
  iframeLoadTimeout,
1186
1150
  onStylesheetLoad,
1187
1151
  stylesheetLoadTimeout,
1188
- keepIframeSrcFn,
1189
- cssCaptured: false
1152
+ keepIframeSrcFn
1190
1153
  };
1191
- if (serializedNode.type === NodeType$3.Element && serializedNode.tagName === "textarea" && serializedNode.attributes.value !== void 0) ;
1154
+ if (serializedNode.type === NodeType$2.Element && serializedNode.tagName === "textarea" && serializedNode.attributes.value !== void 0) ;
1192
1155
  else {
1193
- if (serializedNode.type === NodeType$3.Element && serializedNode.attributes._cssText !== void 0 && typeof serializedNode.attributes._cssText === "string") {
1194
- bypassOptions.cssCaptured = true;
1195
- }
1196
1156
  for (const childN of Array.from(index$1.childNodes(n2))) {
1197
1157
  const serializedChildNode = serializeNodeWithId(childN, bypassOptions);
1198
1158
  if (serializedChildNode) {
@@ -1215,7 +1175,7 @@ function serializeNodeWithId(n2, options) {
1215
1175
  if (parent && isShadowRoot(parent) && isNativeShadowDom(parent)) {
1216
1176
  serializedNode.isShadow = true;
1217
1177
  }
1218
- if (serializedNode.type === NodeType$3.Element && serializedNode.tagName === "iframe") {
1178
+ if (serializedNode.type === NodeType$2.Element && serializedNode.tagName === "iframe") {
1219
1179
  onceIframeLoaded(
1220
1180
  n2,
1221
1181
  () => {
@@ -1257,7 +1217,7 @@ function serializeNodeWithId(n2, options) {
1257
1217
  iframeLoadTimeout
1258
1218
  );
1259
1219
  }
1260
- 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")) {
1220
+ 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")) {
1261
1221
  onceStylesheetLoaded(
1262
1222
  n2,
1263
1223
  () => {
@@ -8536,9 +8496,6 @@ const testableMethods = {
8536
8496
  MutationObserver: ["constructor"]
8537
8497
  };
8538
8498
  const untaintedBasePrototype = {};
8539
- const isAngularZonePresent = () => {
8540
- return !!globalThis.Zone;
8541
- };
8542
8499
  function getUntaintedPrototype(key) {
8543
8500
  if (untaintedBasePrototype[key])
8544
8501
  return untaintedBasePrototype[key];
@@ -8566,7 +8523,7 @@ function getUntaintedPrototype(key) {
8566
8523
  }
8567
8524
  )
8568
8525
  );
8569
- if (isUntaintedAccessors && isUntaintedMethods && !isAngularZonePresent()) {
8526
+ if (isUntaintedAccessors && isUntaintedMethods) {
8570
8527
  untaintedBasePrototype[key] = defaultObj.prototype;
8571
8528
  return defaultObj.prototype;
8572
8529
  }
@@ -8998,15 +8955,6 @@ var MediaInteractions = /* @__PURE__ */ ((MediaInteractions2) => {
8998
8955
  MediaInteractions2[MediaInteractions2["RateChange"] = 4] = "RateChange";
8999
8956
  return MediaInteractions2;
9000
8957
  })(MediaInteractions || {});
9001
- var NodeType = /* @__PURE__ */ ((NodeType2) => {
9002
- NodeType2[NodeType2["Document"] = 0] = "Document";
9003
- NodeType2[NodeType2["DocumentType"] = 1] = "DocumentType";
9004
- NodeType2[NodeType2["Element"] = 2] = "Element";
9005
- NodeType2[NodeType2["Text"] = 3] = "Text";
9006
- NodeType2[NodeType2["CDATA"] = 4] = "CDATA";
9007
- NodeType2[NodeType2["Comment"] = 5] = "Comment";
9008
- return NodeType2;
9009
- })(NodeType || {});
9010
8958
  function isNodeInLinkedList(n2) {
9011
8959
  return "__ln" in n2;
9012
8960
  }
@@ -9101,7 +9049,6 @@ class MutationBuffer {
9101
9049
  __publicField(this, "addedSet", /* @__PURE__ */ new Set());
9102
9050
  __publicField(this, "movedSet", /* @__PURE__ */ new Set());
9103
9051
  __publicField(this, "droppedSet", /* @__PURE__ */ new Set());
9104
- __publicField(this, "removesSubTreeCache", /* @__PURE__ */ new Set());
9105
9052
  __publicField(this, "mutationCb");
9106
9053
  __publicField(this, "blockClass");
9107
9054
  __publicField(this, "blockSelector");
@@ -9146,18 +9093,9 @@ class MutationBuffer {
9146
9093
  };
9147
9094
  const pushAdd = (n2) => {
9148
9095
  const parent = index.parentNode(n2);
9149
- if (!parent || !inDom(n2)) {
9096
+ if (!parent || !inDom(n2) || parent.tagName === "TEXTAREA") {
9150
9097
  return;
9151
9098
  }
9152
- let cssCaptured = false;
9153
- if (n2.nodeType === Node.TEXT_NODE) {
9154
- const parentTag = parent.tagName;
9155
- if (parentTag === "TEXTAREA") {
9156
- return;
9157
- } else if (parentTag === "STYLE" && this.addedSet.has(parent)) {
9158
- cssCaptured = true;
9159
- }
9160
- }
9161
9099
  const parentId = isShadowRoot(parent) ? this.mirror.getId(getShadowHost(n2)) : this.mirror.getId(parent);
9162
9100
  const nextId = getNextId(n2);
9163
9101
  if (parentId === -1 || nextId === -1) {
@@ -9199,8 +9137,7 @@ class MutationBuffer {
9199
9137
  },
9200
9138
  onStylesheetLoad: (link, childSn) => {
9201
9139
  this.stylesheetManager.attachLinkElement(link, childSn);
9202
- },
9203
- cssCaptured
9140
+ }
9204
9141
  });
9205
9142
  if (sn) {
9206
9143
  adds.push({
@@ -9215,13 +9152,13 @@ class MutationBuffer {
9215
9152
  this.mirror.removeNodeFromMap(this.mapRemoves.shift());
9216
9153
  }
9217
9154
  for (const n2 of this.movedSet) {
9218
- if (isParentRemoved(this.removesSubTreeCache, n2, this.mirror) && !this.movedSet.has(index.parentNode(n2))) {
9155
+ if (isParentRemoved(this.removes, n2, this.mirror) && !this.movedSet.has(index.parentNode(n2))) {
9219
9156
  continue;
9220
9157
  }
9221
9158
  pushAdd(n2);
9222
9159
  }
9223
9160
  for (const n2 of this.addedSet) {
9224
- if (!isAncestorInSet(this.droppedSet, n2) && !isParentRemoved(this.removesSubTreeCache, n2, this.mirror)) {
9161
+ if (!isAncestorInSet(this.droppedSet, n2) && !isParentRemoved(this.removes, n2, this.mirror)) {
9225
9162
  pushAdd(n2);
9226
9163
  } else if (isAncestorInSet(this.movedSet, n2)) {
9227
9164
  pushAdd(n2);
@@ -9317,7 +9254,6 @@ class MutationBuffer {
9317
9254
  this.addedSet = /* @__PURE__ */ new Set();
9318
9255
  this.movedSet = /* @__PURE__ */ new Set();
9319
9256
  this.droppedSet = /* @__PURE__ */ new Set();
9320
- this.removesSubTreeCache = /* @__PURE__ */ new Set();
9321
9257
  this.movedMap = {};
9322
9258
  this.mutationCb(payload);
9323
9259
  });
@@ -9472,7 +9408,6 @@ class MutationBuffer {
9472
9408
  id: nodeId,
9473
9409
  isShadow: isShadowRoot(m.target) && isNativeShadowDom(m.target) ? true : void 0
9474
9410
  });
9475
- processRemoves(n2, this.removesSubTreeCache);
9476
9411
  }
9477
9412
  this.mapRemoves.push(n2);
9478
9413
  });
@@ -9567,24 +9502,20 @@ function deepDelete(addsSet, n2) {
9567
9502
  addsSet.delete(n2);
9568
9503
  index.childNodes(n2).forEach((childN) => deepDelete(addsSet, childN));
9569
9504
  }
9570
- function processRemoves(n2, cache) {
9571
- const queue = [n2];
9572
- while (queue.length) {
9573
- const next = queue.pop();
9574
- if (cache.has(next)) continue;
9575
- cache.add(next);
9576
- index.childNodes(next).forEach((n22) => queue.push(n22));
9577
- }
9578
- return;
9579
- }
9580
9505
  function isParentRemoved(removes, n2, mirror2) {
9581
- if (removes.size === 0) return false;
9582
- return _isParentRemoved(removes, n2);
9583
- }
9584
- function _isParentRemoved(removes, n2, _mirror2) {
9585
- const node2 = index.parentNode(n2);
9586
- if (!node2) return false;
9587
- return removes.has(node2);
9506
+ if (removes.length === 0) return false;
9507
+ return _isParentRemoved(removes, n2, mirror2);
9508
+ }
9509
+ function _isParentRemoved(removes, n2, mirror2) {
9510
+ let node2 = index.parentNode(n2);
9511
+ while (node2) {
9512
+ const parentId = mirror2.getId(node2);
9513
+ if (removes.some((r2) => r2.id === parentId)) {
9514
+ return true;
9515
+ }
9516
+ node2 = index.parentNode(node2);
9517
+ }
9518
+ return false;
9588
9519
  }
9589
9520
  function isAncestorInSet(set, n2) {
9590
9521
  if (set.size === 0) return false;
@@ -10922,7 +10853,7 @@ class IframeManager {
10922
10853
  }
10923
10854
  }
10924
10855
  patchRootIdOnNode(node2, rootId) {
10925
- if (node2.type !== NodeType.Document && !node2.rootId) node2.rootId = rootId;
10856
+ if (node2.type !== NodeType$2.Document && !node2.rootId) node2.rootId = rootId;
10926
10857
  if ("childNodes" in node2) {
10927
10858
  node2.childNodes.forEach((child) => {
10928
10859
  this.patchRootIdOnNode(child, rootId);