@screeb/rrweb 1.0.4 → 1.0.6

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
@@ -637,6 +637,21 @@ function needMaskingText(node2, maskTextClass, maskTextSelector, checkAncestors)
637
637
  el = index$1.parentElement(node2);
638
638
  }
639
639
  try {
640
+ if (el.tagName === "INPUT") {
641
+ const autocomplete = el.getAttribute("autocomplete");
642
+ const disallowedAutocompleteValues = [
643
+ "current-password",
644
+ "new-password",
645
+ "cc-number",
646
+ "cc-exp",
647
+ "cc-exp-month",
648
+ "cc-exp-year",
649
+ "cc-csc"
650
+ ];
651
+ if (disallowedAutocompleteValues.includes(autocomplete)) {
652
+ return true;
653
+ }
654
+ }
640
655
  if (typeof maskTextClass === "string") {
641
656
  if (checkAncestors) {
642
657
  if (el.closest(`.${maskTextClass}`)) return true;
@@ -1386,41 +1401,8 @@ const pseudoClassPlugin = {
1386
1401
  }
1387
1402
  fixed.push(rule2);
1388
1403
  rule2.selectors.forEach(function(selector) {
1389
- if (!selector.includes(":")) {
1390
- return;
1391
- }
1392
- const selectorParts = selector.replace(/\n/g, " ").split(" ");
1393
- const pseudoedSelectorParts = [];
1394
- selectorParts.forEach(function(selectorPart) {
1395
- const pseudos = selectorPart.match(/::?([^:]+)/g);
1396
- if (!pseudos) {
1397
- pseudoedSelectorParts.push(selectorPart);
1398
- return;
1399
- }
1400
- const baseSelector = selectorPart.substr(
1401
- 0,
1402
- selectorPart.length - pseudos.join("").length
1403
- );
1404
- const classPseudos = pseudos.map(function(pseudo) {
1405
- const pseudoToCheck = pseudo.replace(/\(.*/g, "");
1406
- if (pseudoToCheck !== ":hover") {
1407
- return pseudo;
1408
- }
1409
- if (pseudo.match(/^::/)) {
1410
- return pseudo;
1411
- }
1412
- pseudo = pseudo.substr(1);
1413
- pseudo = pseudo.replace(/\(/g, "\\(");
1414
- pseudo = pseudo.replace(/\)/g, "\\)");
1415
- return ".\\:" + pseudo;
1416
- });
1417
- pseudoedSelectorParts.push(baseSelector + classPseudos.join(""));
1418
- });
1419
- addSelector(pseudoedSelectorParts.join(" "));
1420
- function addSelector(newSelector) {
1421
- if (newSelector && newSelector !== selector) {
1422
- rule2.selector += ",\n" + newSelector;
1423
- }
1404
+ if (selector.includes(":hover")) {
1405
+ rule2.selector += ",\n" + selector.replace(/:hover/g, ".\\:hover");
1424
1406
  }
1425
1407
  });
1426
1408
  }
@@ -5176,9 +5158,9 @@ function buildNode(n2, options) {
5176
5158
  }
5177
5159
  }
5178
5160
  if (name === "rr_width") {
5179
- node2.style.width = value.toString();
5161
+ node2.style.setProperty("width", value.toString());
5180
5162
  } else if (name === "rr_height") {
5181
- node2.style.height = value.toString();
5163
+ node2.style.setProperty("height", value.toString());
5182
5164
  } else if (name === "rr_mediaCurrentTime" && typeof value === "number") {
5183
5165
  node2.currentTime = value;
5184
5166
  } else if (name === "rr_mediaState") {
@@ -9737,7 +9719,13 @@ function diffProps(oldTree, newTree, rrnodeMirror) {
9737
9719
  }
9738
9720
  };
9739
9721
  } else if (newTree.tagName === "IFRAME" && name === "srcdoc") continue;
9740
- else oldTree.setAttribute(name, newValue);
9722
+ else {
9723
+ try {
9724
+ oldTree.setAttribute(name, newValue);
9725
+ } catch (err) {
9726
+ console.warn(err);
9727
+ }
9728
+ }
9741
9729
  }
9742
9730
  for (const { name } of Array.from(oldAttributes))
9743
9731
  if (!(name in newAttributes)) oldTree.removeAttribute(name);
@@ -10973,6 +10961,7 @@ class MutationBuffer {
10973
10961
  __publicField(this, "addedSet", /* @__PURE__ */ new Set());
10974
10962
  __publicField(this, "movedSet", /* @__PURE__ */ new Set());
10975
10963
  __publicField(this, "droppedSet", /* @__PURE__ */ new Set());
10964
+ __publicField(this, "removesSubTreeCache", /* @__PURE__ */ new Set());
10976
10965
  __publicField(this, "mutationCb");
10977
10966
  __publicField(this, "blockClass");
10978
10967
  __publicField(this, "blockSelector");
@@ -11086,13 +11075,13 @@ class MutationBuffer {
11086
11075
  this.mirror.removeNodeFromMap(this.mapRemoves.shift());
11087
11076
  }
11088
11077
  for (const n2 of this.movedSet) {
11089
- if (isParentRemoved(this.removes, n2, this.mirror) && !this.movedSet.has(index.parentNode(n2))) {
11078
+ if (isParentRemoved(this.removesSubTreeCache, n2, this.mirror) && !this.movedSet.has(index.parentNode(n2))) {
11090
11079
  continue;
11091
11080
  }
11092
11081
  pushAdd(n2);
11093
11082
  }
11094
11083
  for (const n2 of this.addedSet) {
11095
- if (!isAncestorInSet(this.droppedSet, n2) && !isParentRemoved(this.removes, n2, this.mirror)) {
11084
+ if (!isAncestorInSet(this.droppedSet, n2) && !isParentRemoved(this.removesSubTreeCache, n2, this.mirror)) {
11096
11085
  pushAdd(n2);
11097
11086
  } else if (isAncestorInSet(this.movedSet, n2)) {
11098
11087
  pushAdd(n2);
@@ -11188,6 +11177,7 @@ class MutationBuffer {
11188
11177
  this.addedSet = /* @__PURE__ */ new Set();
11189
11178
  this.movedSet = /* @__PURE__ */ new Set();
11190
11179
  this.droppedSet = /* @__PURE__ */ new Set();
11180
+ this.removesSubTreeCache = /* @__PURE__ */ new Set();
11191
11181
  this.movedMap = {};
11192
11182
  this.mutationCb(payload);
11193
11183
  });
@@ -11342,6 +11332,7 @@ class MutationBuffer {
11342
11332
  id: nodeId,
11343
11333
  isShadow: isShadowRoot(m.target) && isNativeShadowDom(m.target) ? true : void 0
11344
11334
  });
11335
+ processRemoves(n2, this.removesSubTreeCache);
11345
11336
  }
11346
11337
  this.mapRemoves.push(n2);
11347
11338
  });
@@ -11439,20 +11430,24 @@ function deepDelete(addsSet, n2) {
11439
11430
  addsSet.delete(n2);
11440
11431
  index.childNodes(n2).forEach((childN) => deepDelete(addsSet, childN));
11441
11432
  }
11442
- function isParentRemoved(removes, n2, mirror2) {
11443
- if (removes.length === 0) return false;
11444
- return _isParentRemoved(removes, n2, mirror2);
11445
- }
11446
- function _isParentRemoved(removes, n2, mirror2) {
11447
- let node2 = index.parentNode(n2);
11448
- while (node2) {
11449
- const parentId = mirror2.getId(node2);
11450
- if (removes.some((r2) => r2.id === parentId)) {
11451
- return true;
11452
- }
11453
- node2 = index.parentNode(node2);
11433
+ function processRemoves(n2, cache) {
11434
+ const queue = [n2];
11435
+ while (queue.length) {
11436
+ const next = queue.pop();
11437
+ if (cache.has(next)) continue;
11438
+ cache.add(next);
11439
+ index.childNodes(next).forEach((n22) => queue.push(n22));
11454
11440
  }
11455
- return false;
11441
+ return;
11442
+ }
11443
+ function isParentRemoved(removes, n2, mirror2) {
11444
+ if (removes.size === 0) return false;
11445
+ return _isParentRemoved(removes, n2);
11446
+ }
11447
+ function _isParentRemoved(removes, n2, _mirror) {
11448
+ const node2 = index.parentNode(n2);
11449
+ if (!node2) return false;
11450
+ return removes.has(node2);
11456
11451
  }
11457
11452
  function isAncestorInSet(set, n2) {
11458
11453
  if (set.size === 0) return false;