@appsurify-testmap/rrweb-all 2.1.0-alpha.5 → 2.1.0-alpha.7

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.
@@ -11683,7 +11683,7 @@ class MutationBuffer {
11683
11683
  let value = m.target.getAttribute(attributeName);
11684
11684
  const propValue = target[attributeName];
11685
11685
  const isPhantomAttributeMutation = value === null && !target.hasAttribute(attributeName) && m.oldValue !== null && (propValue === "" || propValue === null || typeof propValue === "undefined");
11686
- if (isPhantomAttributeMutation && !isIncludeAttribute(attributeName, this.includeAttribute)) {
11686
+ if (isPhantomAttributeMutation) {
11687
11687
  return;
11688
11688
  }
11689
11689
  if (isExcludeAttribute(attributeName, this.excludeAttribute)) {
@@ -11731,12 +11731,8 @@ class MutationBuffer {
11731
11731
  toLowerCase(attributeName),
11732
11732
  value
11733
11733
  );
11734
- if (value === item.attributes[attributeName] && !isIncludeAttribute(attributeName, this.includeAttribute)) {
11735
- delete item.attributes[attributeName];
11736
- if (Object.keys(item.attributes).length === 0) {
11737
- this.attributes = this.attributes.filter((a2) => a2 !== item);
11738
- this.attributeMap.delete(m.target);
11739
- }
11734
+ if (value === item.attributes[attributeName]) {
11735
+ console.debug("[rrweb-record] A questionable mutation that needs to be investigated in the future.");
11740
11736
  return;
11741
11737
  }
11742
11738
  if (attributeName === "style") {
@@ -14031,6 +14027,7 @@ let wrappedEmit;
14031
14027
  let takeFullSnapshot$1;
14032
14028
  let canvasManager;
14033
14029
  let recording = false;
14030
+ const preRecordingCustomEvents = [];
14034
14031
  try {
14035
14032
  if (Array.from([1], (x2) => x2 * 2)[0] !== 2) {
14036
14033
  const cleanFrame = document.createElement("iframe");
@@ -14070,6 +14067,7 @@ function record(options = {}) {
14070
14067
  recordCanvas = false,
14071
14068
  recordCrossOriginIframes = false,
14072
14069
  recordAfter = options.recordAfter === "DOMContentLoaded" ? options.recordAfter : "load",
14070
+ flushCustomQueue = options.flushCustomQueue !== void 0 ? options.flushCustomQueue : "after",
14073
14071
  userTriggeredOnInput = false,
14074
14072
  collectFonts = false,
14075
14073
  inlineImages = false,
@@ -14480,9 +14478,15 @@ function record(options = {}) {
14480
14478
  }
14481
14479
  });
14482
14480
  const init = () => {
14481
+ if (flushCustomQueue === "before") {
14482
+ flushPreRecordingEvents();
14483
+ }
14483
14484
  takeFullSnapshot$1();
14484
14485
  handlers.push(observe(document));
14485
14486
  recording = true;
14487
+ if (flushCustomQueue === "after") {
14488
+ flushPreRecordingEvents();
14489
+ }
14486
14490
  };
14487
14491
  if (document.readyState === "interactive" || document.readyState === "complete") {
14488
14492
  init();
@@ -14511,6 +14515,7 @@ function record(options = {}) {
14511
14515
  );
14512
14516
  }
14513
14517
  return () => {
14518
+ flushPreRecordingEvents();
14514
14519
  handlers.forEach((h) => h());
14515
14520
  processedNodeManager.destroy();
14516
14521
  recording = false;
@@ -14520,17 +14525,26 @@ function record(options = {}) {
14520
14525
  console.warn(error);
14521
14526
  }
14522
14527
  }
14523
- record.addCustomEvent = (tag, payload) => {
14524
- if (!recording) {
14525
- throw new Error("please add custom event after start recording");
14528
+ function flushPreRecordingEvents() {
14529
+ for (const e2 of preRecordingCustomEvents) {
14530
+ wrappedEmit(e2);
14526
14531
  }
14527
- wrappedEmit({
14532
+ preRecordingCustomEvents.length = 0;
14533
+ }
14534
+ record.addCustomEvent = (tag, payload) => {
14535
+ const customEvent = {
14528
14536
  type: EventType.Custom,
14529
14537
  data: {
14530
14538
  tag,
14531
14539
  payload
14532
14540
  }
14533
- });
14541
+ };
14542
+ if (!recording) {
14543
+ console.warn(`[rrweb] CustomEvent buffered before recording start: ${tag}`);
14544
+ preRecordingCustomEvents.push(customEvent);
14545
+ return;
14546
+ }
14547
+ wrappedEmit(customEvent);
14534
14548
  };
14535
14549
  record.freezePage = () => {
14536
14550
  mutationBuffers.forEach((buf) => buf.freeze());