@appsurify-testmap/rrweb-record 2.1.0-alpha.2 → 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") {
@@ -9179,9 +9183,8 @@ function hookSetter(target, key, d, isRevoked, win = window) {
9179
9183
  );
9180
9184
  return () => hookSetter(target, key, original || {}, true);
9181
9185
  }
9182
- let nowTimestamp = Date.now;
9183
- if (!/* @__PURE__ */ /[1-9][0-9]{12}/.test(Date.now().toString())) {
9184
- nowTimestamp = () => (/* @__PURE__ */ new Date()).getTime();
9186
+ function nowTimestamp() {
9187
+ return performance.timeOrigin + performance.now();
9185
9188
  }
9186
9189
  function getWindowScroll(win = window) {
9187
9190
  var _a2, _b, _c, _d;
@@ -9701,6 +9704,21 @@ class MutationBuffer {
9701
9704
  };
9702
9705
  }).filter((text) => !addedIds.has(text.id)).filter((text) => this.mirror.has(text.id)),
9703
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) => {
9704
9722
  const { attributes } = attribute;
9705
9723
  if (typeof attributes.style === "string") {
9706
9724
  const diffAsStr = JSON.stringify(attribute.styleDiff);
@@ -9782,7 +9800,10 @@ class MutationBuffer {
9782
9800
  case "attributes": {
9783
9801
  const target = m.target;
9784
9802
  let attributeName = m.attributeName;
9785
- let value = m.target.getAttribute(attributeName);
9803
+ let value = target.getAttribute(attributeName);
9804
+ if (value === null && m.oldValue === null) {
9805
+ return;
9806
+ }
9786
9807
  if (attributeName === "value") {
9787
9808
  const type = getInputType(target);
9788
9809
  value = maskInputValue({
@@ -9818,7 +9839,8 @@ class MutationBuffer {
9818
9839
  if (attributeName === "type" && target.tagName === "INPUT" && (m.oldValue || "").toLowerCase() === "password") {
9819
9840
  target.setAttribute("data-rr-is-password", "true");
9820
9841
  }
9821
- 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)) {
9822
9844
  item.attributes[attributeName] = transformAttribute(
9823
9845
  this.doc,
9824
9846
  toLowerCase(target.tagName),