@posthog/rrweb 0.0.22 → 0.0.24

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
@@ -17073,16 +17073,6 @@ class Replayer {
17073
17073
  ...this.legacy_missingNodeRetryMap
17074
17074
  };
17075
17075
  const queue = [];
17076
- const nextNotInDOM = (mutation) => {
17077
- let next = null;
17078
- if (mutation.nextId) {
17079
- next = mirror2.getNode(mutation.nextId);
17080
- }
17081
- if (mutation.nextId !== null && mutation.nextId !== void 0 && mutation.nextId !== -1 && !next) {
17082
- return true;
17083
- }
17084
- return false;
17085
- };
17086
17076
  const appendNode = (mutation) => {
17087
17077
  var _a2, _b;
17088
17078
  if (!this.iframe.contentDocument) {
@@ -17095,7 +17085,10 @@ class Replayer {
17095
17085
  if (mutation.node.type === NodeType.Document) {
17096
17086
  return this.newDocumentQueue.push(mutation);
17097
17087
  }
17098
- return queue.push(mutation);
17088
+ const parentIdInCurrentBatch = d.adds.some(
17089
+ (add) => add.node.id === mutation.parentId
17090
+ );
17091
+ return parentIdInCurrentBatch ? queue.push(mutation) : void 0;
17099
17092
  }
17100
17093
  if (mutation.node.isShadow) {
17101
17094
  if (!hasShadowRoot(parent)) {
@@ -17111,9 +17104,6 @@ class Replayer {
17111
17104
  if (mutation.nextId) {
17112
17105
  next = mirror2.getNode(mutation.nextId);
17113
17106
  }
17114
- if (nextNotInDOM(mutation)) {
17115
- return queue.push(mutation);
17116
- }
17117
17107
  if (mutation.node.rootId && !mirror2.getNode(mutation.node.rootId)) {
17118
17108
  return;
17119
17109
  }
@@ -17219,11 +17209,11 @@ class Replayer {
17219
17209
  d.adds.forEach((mutation) => {
17220
17210
  appendNode(mutation);
17221
17211
  });
17222
- const startTime = Date.now();
17212
+ const startTime = performance.now();
17223
17213
  while (queue.length) {
17224
17214
  const resolveTrees = queueToResolveTrees(queue);
17225
17215
  queue.length = 0;
17226
- if (Date.now() - startTime > 500) {
17216
+ if (performance.now() - startTime > 150) {
17227
17217
  this.warn(
17228
17218
  "Timeout in the loop, please check the resolve tree data:",
17229
17219
  resolveTrees
@@ -17478,12 +17468,13 @@ class Replayer {
17478
17468
  }
17479
17469
  }
17480
17470
  applyStyleDeclaration(data, styleSheet) {
17471
+ var _a2, _b;
17481
17472
  if (data.set) {
17482
17473
  const rule2 = getNestedRule(
17483
17474
  styleSheet.rules,
17484
17475
  data.index
17485
17476
  );
17486
- rule2.style.setProperty(
17477
+ (_a2 = rule2 == null ? void 0 : rule2.style) == null ? void 0 : _a2.setProperty(
17487
17478
  data.set.property,
17488
17479
  data.set.value,
17489
17480
  data.set.priority
@@ -17494,7 +17485,7 @@ class Replayer {
17494
17485
  styleSheet.rules,
17495
17486
  data.index
17496
17487
  );
17497
- rule2.style.removeProperty(data.remove.property);
17488
+ (_b = rule2 == null ? void 0 : rule2.style) == null ? void 0 : _b.removeProperty(data.remove.property);
17498
17489
  }
17499
17490
  }
17500
17491
  applyAdoptedStyleSheet(data) {