@appsurify-testmap/rrweb-record 2.1.0-alpha.1 → 2.1.0-alpha.3

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.
@@ -903,6 +903,10 @@ function cleanAttributes(doc, element, ignoreAttribute) {
903
903
  }
904
904
  return attributes;
905
905
  }
906
+ function shouldIgnoreAttribute(ignore, name) {
907
+ if (!ignore) return false;
908
+ return typeof ignore === "string" ? name === ignore : ignore.test(name);
909
+ }
906
910
  function _isBlockedElement(element, blockClass, blockSelector) {
907
911
  try {
908
912
  if (typeof blockClass === "string") {
@@ -1629,7 +1633,6 @@ function snapshot(n2, options) {
1629
1633
  stylesheetLoadTimeout,
1630
1634
  keepIframeSrcFn = () => false
1631
1635
  } = options || {};
1632
- console.debug(`${Date.now()} [rrweb-snapshot] snapshot:options:`, options);
1633
1636
  const maskInputOptions = maskAllInputs === true ? {
1634
1637
  color: true,
1635
1638
  date: true,
@@ -9180,9 +9183,8 @@ function hookSetter(target, key, d, isRevoked, win = window) {
9180
9183
  );
9181
9184
  return () => hookSetter(target, key, original || {}, true);
9182
9185
  }
9183
- let nowTimestamp = Date.now;
9184
- if (!/* @__PURE__ */ /[1-9][0-9]{12}/.test(Date.now().toString())) {
9185
- nowTimestamp = () => (/* @__PURE__ */ new Date()).getTime();
9186
+ function nowTimestamp() {
9187
+ return performance.timeOrigin + performance.now();
9186
9188
  }
9187
9189
  function getWindowScroll(win = window) {
9188
9190
  var _a2, _b, _c, _d;
@@ -9702,6 +9704,21 @@ class MutationBuffer {
9702
9704
  };
9703
9705
  }).filter((text) => !addedIds.has(text.id)).filter((text) => this.mirror.has(text.id)),
9704
9706
  attributes: this.attributes.map((attribute) => {
9707
+ const element = attribute.node;
9708
+ const filtered = {};
9709
+ for (const [name, value] of Object.entries(attribute.attributes)) {
9710
+ const isIgnored2 = shouldIgnoreAttribute(this.ignoreAttribute, name);
9711
+ const existedBefore = element.hasAttribute(name);
9712
+ const keep = value !== null && !isIgnored2 || value === null && (!isIgnored2 || attribute.attributes[name] !== null || existedBefore);
9713
+ if (keep) {
9714
+ filtered[name] = value;
9715
+ }
9716
+ }
9717
+ return {
9718
+ ...attribute,
9719
+ attributes: filtered
9720
+ };
9721
+ }).filter((attribute) => Object.keys(attribute.attributes).length > 0).map((attribute) => {
9705
9722
  const { attributes } = attribute;
9706
9723
  if (typeof attributes.style === "string") {
9707
9724
  const diffAsStr = JSON.stringify(attribute.styleDiff);
@@ -9783,7 +9800,10 @@ class MutationBuffer {
9783
9800
  case "attributes": {
9784
9801
  const target = m.target;
9785
9802
  let attributeName = m.attributeName;
9786
- let value = m.target.getAttribute(attributeName);
9803
+ let value = target.getAttribute(attributeName);
9804
+ if (value === null && m.oldValue === null) {
9805
+ return;
9806
+ }
9787
9807
  if (attributeName === "value") {
9788
9808
  const type = getInputType(target);
9789
9809
  value = maskInputValue({
@@ -9819,7 +9839,8 @@ class MutationBuffer {
9819
9839
  if (attributeName === "type" && target.tagName === "INPUT" && (m.oldValue || "").toLowerCase() === "password") {
9820
9840
  target.setAttribute("data-rr-is-password", "true");
9821
9841
  }
9822
- if (!isIgnoreAttribute(target.tagName, attributeName)) {
9842
+ if (!isIgnoreAttribute(target.tagName, attributeName) && // eslint-disable-next-line @typescript-eslint/no-unsafe-call
9843
+ !shouldIgnoreAttribute(this.ignoreAttribute, attributeName)) {
9823
9844
  item.attributes[attributeName] = transformAttribute(
9824
9845
  this.doc,
9825
9846
  toLowerCase(target.tagName),
@@ -12193,7 +12214,6 @@ function record(options = {}) {
12193
12214
  ignoreCSSAttributes = /* @__PURE__ */ new Set([]),
12194
12215
  errorHandler: errorHandler2
12195
12216
  } = options;
12196
- console.debug(`${Date.now()} [rrweb] record:options:`, options);
12197
12217
  registerErrorHandler(errorHandler2);
12198
12218
  const inEmittingFrame = recordCrossOriginIframes ? window.parent === window : true;
12199
12219
  let passEmitsToParent = false;