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