@appsurify-testmap/rrweb 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.
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") {
@@ -1641,7 +1645,6 @@ function snapshot(n2, options) {
1641
1645
  stylesheetLoadTimeout,
1642
1646
  keepIframeSrcFn = () => false
1643
1647
  } = options || {};
1644
- console.debug(`${Date.now()} [rrweb-snapshot] snapshot:options:`, options);
1645
1648
  const maskInputOptions = maskAllInputs === true ? {
1646
1649
  color: true,
1647
1650
  date: true,
@@ -10920,9 +10923,8 @@ function hookSetter(target, key, d, isRevoked, win = window) {
10920
10923
  );
10921
10924
  return () => hookSetter(target, key, original || {}, true);
10922
10925
  }
10923
- let nowTimestamp = Date.now;
10924
- if (!/* @__PURE__ */ /[1-9][0-9]{12}/.test(Date.now().toString())) {
10925
- nowTimestamp = () => (/* @__PURE__ */ new Date()).getTime();
10926
+ function nowTimestamp() {
10927
+ return performance.timeOrigin + performance.now();
10926
10928
  }
10927
10929
  function getWindowScroll(win = window) {
10928
10930
  var _a2, _b, _c, _d;
@@ -11203,9 +11205,7 @@ const utils = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePropert
11203
11205
  isSerializedStylesheet,
11204
11206
  iterateResolveTree,
11205
11207
  legacy_isTouchEvent,
11206
- get nowTimestamp() {
11207
- return nowTimestamp;
11208
- },
11208
+ nowTimestamp,
11209
11209
  on,
11210
11210
  polyfill: polyfill$1,
11211
11211
  queueToResolveTrees,
@@ -11608,6 +11608,21 @@ class MutationBuffer {
11608
11608
  };
11609
11609
  }).filter((text) => !addedIds.has(text.id)).filter((text) => this.mirror.has(text.id)),
11610
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) => {
11611
11626
  const { attributes } = attribute;
11612
11627
  if (typeof attributes.style === "string") {
11613
11628
  const diffAsStr = JSON.stringify(attribute.styleDiff);
@@ -11689,7 +11704,10 @@ class MutationBuffer {
11689
11704
  case "attributes": {
11690
11705
  const target = m.target;
11691
11706
  let attributeName = m.attributeName;
11692
- let value = m.target.getAttribute(attributeName);
11707
+ let value = target.getAttribute(attributeName);
11708
+ if (value === null && m.oldValue === null) {
11709
+ return;
11710
+ }
11693
11711
  if (attributeName === "value") {
11694
11712
  const type = getInputType(target);
11695
11713
  value = maskInputValue({
@@ -11725,7 +11743,8 @@ class MutationBuffer {
11725
11743
  if (attributeName === "type" && target.tagName === "INPUT" && (m.oldValue || "").toLowerCase() === "password") {
11726
11744
  target.setAttribute("data-rr-is-password", "true");
11727
11745
  }
11728
- 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)) {
11729
11748
  item.attributes[attributeName] = transformAttribute(
11730
11749
  this.doc,
11731
11750
  toLowerCase(target.tagName),
@@ -14122,7 +14141,6 @@ function record(options = {}) {
14122
14141
  ignoreCSSAttributes = /* @__PURE__ */ new Set([]),
14123
14142
  errorHandler: errorHandler2
14124
14143
  } = options;
14125
- console.debug(`${Date.now()} [rrweb] record:options:`, options);
14126
14144
  registerErrorHandler(errorHandler2);
14127
14145
  const inEmittingFrame = recordCrossOriginIframes ? window.parent === window : true;
14128
14146
  let passEmitsToParent = false;