@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.
@@ -682,6 +682,21 @@ function needMaskingText(node2, maskTextClass, maskTextSelector, checkAncestors)
682
682
  el = index$1.parentElement(node2);
683
683
  }
684
684
  try {
685
+ if (el.tagName === "INPUT") {
686
+ const autocomplete = el.getAttribute("autocomplete");
687
+ const disallowedAutocompleteValues = [
688
+ "current-password",
689
+ "new-password",
690
+ "cc-number",
691
+ "cc-exp",
692
+ "cc-exp-month",
693
+ "cc-exp-year",
694
+ "cc-csc"
695
+ ];
696
+ if (disallowedAutocompleteValues.includes(autocomplete)) {
697
+ return true;
698
+ }
699
+ }
685
700
  if (typeof maskTextClass === "string") {
686
701
  if (checkAncestors) {
687
702
  if (el.closest(`.${maskTextClass}`)) return true;
@@ -1431,41 +1446,8 @@ const pseudoClassPlugin = {
1431
1446
  }
1432
1447
  fixed.push(rule2);
1433
1448
  rule2.selectors.forEach(function(selector) {
1434
- if (!selector.includes(":")) {
1435
- return;
1436
- }
1437
- const selectorParts = selector.replace(/\n/g, " ").split(" ");
1438
- const pseudoedSelectorParts = [];
1439
- selectorParts.forEach(function(selectorPart) {
1440
- const pseudos = selectorPart.match(/::?([^:]+)/g);
1441
- if (!pseudos) {
1442
- pseudoedSelectorParts.push(selectorPart);
1443
- return;
1444
- }
1445
- const baseSelector = selectorPart.substr(
1446
- 0,
1447
- selectorPart.length - pseudos.join("").length
1448
- );
1449
- const classPseudos = pseudos.map(function(pseudo) {
1450
- const pseudoToCheck = pseudo.replace(/\(.*/g, "");
1451
- if (pseudoToCheck !== ":hover") {
1452
- return pseudo;
1453
- }
1454
- if (pseudo.match(/^::/)) {
1455
- return pseudo;
1456
- }
1457
- pseudo = pseudo.substr(1);
1458
- pseudo = pseudo.replace(/\(/g, "\\(");
1459
- pseudo = pseudo.replace(/\)/g, "\\)");
1460
- return ".\\:" + pseudo;
1461
- });
1462
- pseudoedSelectorParts.push(baseSelector + classPseudos.join(""));
1463
- });
1464
- addSelector(pseudoedSelectorParts.join(" "));
1465
- function addSelector(newSelector) {
1466
- if (newSelector && newSelector !== selector) {
1467
- rule2.selector += ",\n" + newSelector;
1468
- }
1449
+ if (selector.includes(":hover")) {
1450
+ rule2.selector += ",\n" + selector.replace(/:hover/g, ".\\:hover");
1469
1451
  }
1470
1452
  });
1471
1453
  }
@@ -5225,9 +5207,9 @@ function buildNode(n2, options) {
5225
5207
  }
5226
5208
  }
5227
5209
  if (name === "rr_width") {
5228
- node2.style.width = value.toString();
5210
+ node2.style.setProperty("width", value.toString());
5229
5211
  } else if (name === "rr_height") {
5230
- node2.style.height = value.toString();
5212
+ node2.style.setProperty("height", value.toString());
5231
5213
  } else if (name === "rr_mediaCurrentTime" && typeof value === "number") {
5232
5214
  node2.currentTime = value;
5233
5215
  } else if (name === "rr_mediaState") {
@@ -9790,7 +9772,13 @@ function diffProps(oldTree, newTree, rrnodeMirror) {
9790
9772
  }
9791
9773
  };
9792
9774
  } else if (newTree.tagName === "IFRAME" && name === "srcdoc") continue;
9793
- else oldTree.setAttribute(name, newValue);
9775
+ else {
9776
+ try {
9777
+ oldTree.setAttribute(name, newValue);
9778
+ } catch (err) {
9779
+ console.warn(err);
9780
+ }
9781
+ }
9794
9782
  }
9795
9783
  for (const { name } of Array.from(oldAttributes))
9796
9784
  if (!(name in newAttributes)) oldTree.removeAttribute(name);
@@ -11010,6 +10998,7 @@ class MutationBuffer {
11010
10998
  __publicField(this, "addedSet", /* @__PURE__ */ new Set());
11011
10999
  __publicField(this, "movedSet", /* @__PURE__ */ new Set());
11012
11000
  __publicField(this, "droppedSet", /* @__PURE__ */ new Set());
11001
+ __publicField(this, "removesSubTreeCache", /* @__PURE__ */ new Set());
11013
11002
  __publicField(this, "mutationCb");
11014
11003
  __publicField(this, "blockClass");
11015
11004
  __publicField(this, "blockSelector");
@@ -11123,13 +11112,13 @@ class MutationBuffer {
11123
11112
  this.mirror.removeNodeFromMap(this.mapRemoves.shift());
11124
11113
  }
11125
11114
  for (const n2 of this.movedSet) {
11126
- if (isParentRemoved(this.removes, n2, this.mirror) && !this.movedSet.has(index.parentNode(n2))) {
11115
+ if (isParentRemoved(this.removesSubTreeCache, n2, this.mirror) && !this.movedSet.has(index.parentNode(n2))) {
11127
11116
  continue;
11128
11117
  }
11129
11118
  pushAdd(n2);
11130
11119
  }
11131
11120
  for (const n2 of this.addedSet) {
11132
- if (!isAncestorInSet(this.droppedSet, n2) && !isParentRemoved(this.removes, n2, this.mirror)) {
11121
+ if (!isAncestorInSet(this.droppedSet, n2) && !isParentRemoved(this.removesSubTreeCache, n2, this.mirror)) {
11133
11122
  pushAdd(n2);
11134
11123
  } else if (isAncestorInSet(this.movedSet, n2)) {
11135
11124
  pushAdd(n2);
@@ -11225,6 +11214,7 @@ class MutationBuffer {
11225
11214
  this.addedSet = /* @__PURE__ */ new Set();
11226
11215
  this.movedSet = /* @__PURE__ */ new Set();
11227
11216
  this.droppedSet = /* @__PURE__ */ new Set();
11217
+ this.removesSubTreeCache = /* @__PURE__ */ new Set();
11228
11218
  this.movedMap = {};
11229
11219
  this.mutationCb(payload);
11230
11220
  });
@@ -11379,6 +11369,7 @@ class MutationBuffer {
11379
11369
  id: nodeId,
11380
11370
  isShadow: isShadowRoot(m.target) && isNativeShadowDom(m.target) ? true : void 0
11381
11371
  });
11372
+ processRemoves(n2, this.removesSubTreeCache);
11382
11373
  }
11383
11374
  this.mapRemoves.push(n2);
11384
11375
  });
@@ -11473,20 +11464,24 @@ function deepDelete(addsSet, n2) {
11473
11464
  addsSet.delete(n2);
11474
11465
  index.childNodes(n2).forEach((childN) => deepDelete(addsSet, childN));
11475
11466
  }
11476
- function isParentRemoved(removes, n2, mirror2) {
11477
- if (removes.length === 0) return false;
11478
- return _isParentRemoved(removes, n2, mirror2);
11479
- }
11480
- function _isParentRemoved(removes, n2, mirror2) {
11481
- let node2 = index.parentNode(n2);
11482
- while (node2) {
11483
- const parentId = mirror2.getId(node2);
11484
- if (removes.some((r2) => r2.id === parentId)) {
11485
- return true;
11486
- }
11487
- node2 = index.parentNode(node2);
11467
+ function processRemoves(n2, cache) {
11468
+ const queue = [n2];
11469
+ while (queue.length) {
11470
+ const next = queue.pop();
11471
+ if (cache.has(next)) continue;
11472
+ cache.add(next);
11473
+ index.childNodes(next).forEach((n22) => queue.push(n22));
11488
11474
  }
11489
- return false;
11475
+ return;
11476
+ }
11477
+ function isParentRemoved(removes, n2, mirror2) {
11478
+ if (removes.size === 0) return false;
11479
+ return _isParentRemoved(removes, n2);
11480
+ }
11481
+ function _isParentRemoved(removes, n2, _mirror) {
11482
+ const node2 = index.parentNode(n2);
11483
+ if (!node2) return false;
11484
+ return removes.has(node2);
11490
11485
  }
11491
11486
  function isAncestorInSet(set, n2) {
11492
11487
  if (set.size === 0) return false;