@appsurify-testmap/rrweb 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.
package/dist/rrweb.cjs CHANGED
@@ -915,6 +915,10 @@ function cleanAttributes(doc, element, ignoreAttribute) {
915
915
  }
916
916
  return attributes;
917
917
  }
918
+ function shouldIgnoreAttribute(ignore, name) {
919
+ if (!ignore) return false;
920
+ return typeof ignore === "string" ? name === ignore : ignore.test(name);
921
+ }
918
922
  function _isBlockedElement(element, blockClass, blockSelector) {
919
923
  try {
920
924
  if (typeof blockClass === "string") {
@@ -10919,9 +10923,8 @@ function hookSetter(target, key, d, isRevoked, win = window) {
10919
10923
  );
10920
10924
  return () => hookSetter(target, key, original || {}, true);
10921
10925
  }
10922
- let nowTimestamp = Date.now;
10923
- if (!/* @__PURE__ */ /[1-9][0-9]{12}/.test(Date.now().toString())) {
10924
- nowTimestamp = () => (/* @__PURE__ */ new Date()).getTime();
10926
+ function nowTimestamp() {
10927
+ return performance.timeOrigin + performance.now();
10925
10928
  }
10926
10929
  function getWindowScroll(win = window) {
10927
10930
  var _a2, _b, _c, _d;
@@ -11202,9 +11205,7 @@ const utils = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePropert
11202
11205
  isSerializedStylesheet,
11203
11206
  iterateResolveTree,
11204
11207
  legacy_isTouchEvent,
11205
- get nowTimestamp() {
11206
- return nowTimestamp;
11207
- },
11208
+ nowTimestamp,
11208
11209
  on,
11209
11210
  polyfill: polyfill$1,
11210
11211
  queueToResolveTrees,
@@ -11607,6 +11608,21 @@ class MutationBuffer {
11607
11608
  };
11608
11609
  }).filter((text) => !addedIds.has(text.id)).filter((text) => this.mirror.has(text.id)),
11609
11610
  attributes: this.attributes.map((attribute) => {
11611
+ const element = attribute.node;
11612
+ const filtered = {};
11613
+ for (const [name, value] of Object.entries(attribute.attributes)) {
11614
+ const isIgnored2 = shouldIgnoreAttribute(this.ignoreAttribute, name);
11615
+ const existedBefore = element.hasAttribute(name);
11616
+ const keep = value !== null && !isIgnored2 || value === null && (!isIgnored2 || attribute.attributes[name] !== null || existedBefore);
11617
+ if (keep) {
11618
+ filtered[name] = value;
11619
+ }
11620
+ }
11621
+ return {
11622
+ ...attribute,
11623
+ attributes: filtered
11624
+ };
11625
+ }).filter((attribute) => Object.keys(attribute.attributes).length > 0).map((attribute) => {
11610
11626
  const { attributes } = attribute;
11611
11627
  if (typeof attributes.style === "string") {
11612
11628
  const diffAsStr = JSON.stringify(attribute.styleDiff);
@@ -11688,7 +11704,10 @@ class MutationBuffer {
11688
11704
  case "attributes": {
11689
11705
  const target = m.target;
11690
11706
  let attributeName = m.attributeName;
11691
- let value = m.target.getAttribute(attributeName);
11707
+ let value = target.getAttribute(attributeName);
11708
+ if (value === null && m.oldValue === null) {
11709
+ return;
11710
+ }
11692
11711
  if (attributeName === "value") {
11693
11712
  const type = getInputType(target);
11694
11713
  value = maskInputValue({
@@ -11724,7 +11743,8 @@ class MutationBuffer {
11724
11743
  if (attributeName === "type" && target.tagName === "INPUT" && (m.oldValue || "").toLowerCase() === "password") {
11725
11744
  target.setAttribute("data-rr-is-password", "true");
11726
11745
  }
11727
- if (!isIgnoreAttribute(target.tagName, attributeName)) {
11746
+ if (!isIgnoreAttribute(target.tagName, attributeName) && // eslint-disable-next-line @typescript-eslint/no-unsafe-call
11747
+ !shouldIgnoreAttribute(this.ignoreAttribute, attributeName)) {
11728
11748
  item.attributes[attributeName] = transformAttribute(
11729
11749
  this.doc,
11730
11750
  toLowerCase(target.tagName),