@screeb/rrweb 1.0.4 → 1.0.5

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.
@@ -1431,41 +1431,8 @@ const pseudoClassPlugin = {
1431
1431
  }
1432
1432
  fixed.push(rule2);
1433
1433
  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
- }
1434
+ if (selector.includes(":hover")) {
1435
+ rule2.selector += ",\n" + selector.replace(/:hover/g, ".\\:hover");
1469
1436
  }
1470
1437
  });
1471
1438
  }
@@ -5225,9 +5192,9 @@ function buildNode(n2, options) {
5225
5192
  }
5226
5193
  }
5227
5194
  if (name === "rr_width") {
5228
- node2.style.width = value.toString();
5195
+ node2.style.setProperty("width", value.toString());
5229
5196
  } else if (name === "rr_height") {
5230
- node2.style.height = value.toString();
5197
+ node2.style.setProperty("height", value.toString());
5231
5198
  } else if (name === "rr_mediaCurrentTime" && typeof value === "number") {
5232
5199
  node2.currentTime = value;
5233
5200
  } else if (name === "rr_mediaState") {
@@ -9790,7 +9757,13 @@ function diffProps(oldTree, newTree, rrnodeMirror) {
9790
9757
  }
9791
9758
  };
9792
9759
  } else if (newTree.tagName === "IFRAME" && name === "srcdoc") continue;
9793
- else oldTree.setAttribute(name, newValue);
9760
+ else {
9761
+ try {
9762
+ oldTree.setAttribute(name, newValue);
9763
+ } catch (err) {
9764
+ console.warn(err);
9765
+ }
9766
+ }
9794
9767
  }
9795
9768
  for (const { name } of Array.from(oldAttributes))
9796
9769
  if (!(name in newAttributes)) oldTree.removeAttribute(name);
@@ -11010,6 +10983,7 @@ class MutationBuffer {
11010
10983
  __publicField(this, "addedSet", /* @__PURE__ */ new Set());
11011
10984
  __publicField(this, "movedSet", /* @__PURE__ */ new Set());
11012
10985
  __publicField(this, "droppedSet", /* @__PURE__ */ new Set());
10986
+ __publicField(this, "removesSubTreeCache", /* @__PURE__ */ new Set());
11013
10987
  __publicField(this, "mutationCb");
11014
10988
  __publicField(this, "blockClass");
11015
10989
  __publicField(this, "blockSelector");
@@ -11123,13 +11097,13 @@ class MutationBuffer {
11123
11097
  this.mirror.removeNodeFromMap(this.mapRemoves.shift());
11124
11098
  }
11125
11099
  for (const n2 of this.movedSet) {
11126
- if (isParentRemoved(this.removes, n2, this.mirror) && !this.movedSet.has(index.parentNode(n2))) {
11100
+ if (isParentRemoved(this.removesSubTreeCache, n2, this.mirror) && !this.movedSet.has(index.parentNode(n2))) {
11127
11101
  continue;
11128
11102
  }
11129
11103
  pushAdd(n2);
11130
11104
  }
11131
11105
  for (const n2 of this.addedSet) {
11132
- if (!isAncestorInSet(this.droppedSet, n2) && !isParentRemoved(this.removes, n2, this.mirror)) {
11106
+ if (!isAncestorInSet(this.droppedSet, n2) && !isParentRemoved(this.removesSubTreeCache, n2, this.mirror)) {
11133
11107
  pushAdd(n2);
11134
11108
  } else if (isAncestorInSet(this.movedSet, n2)) {
11135
11109
  pushAdd(n2);
@@ -11225,6 +11199,7 @@ class MutationBuffer {
11225
11199
  this.addedSet = /* @__PURE__ */ new Set();
11226
11200
  this.movedSet = /* @__PURE__ */ new Set();
11227
11201
  this.droppedSet = /* @__PURE__ */ new Set();
11202
+ this.removesSubTreeCache = /* @__PURE__ */ new Set();
11228
11203
  this.movedMap = {};
11229
11204
  this.mutationCb(payload);
11230
11205
  });
@@ -11379,6 +11354,7 @@ class MutationBuffer {
11379
11354
  id: nodeId,
11380
11355
  isShadow: isShadowRoot(m.target) && isNativeShadowDom(m.target) ? true : void 0
11381
11356
  });
11357
+ processRemoves(n2, this.removesSubTreeCache);
11382
11358
  }
11383
11359
  this.mapRemoves.push(n2);
11384
11360
  });
@@ -11473,20 +11449,24 @@ function deepDelete(addsSet, n2) {
11473
11449
  addsSet.delete(n2);
11474
11450
  index.childNodes(n2).forEach((childN) => deepDelete(addsSet, childN));
11475
11451
  }
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);
11452
+ function processRemoves(n2, cache) {
11453
+ const queue = [n2];
11454
+ while (queue.length) {
11455
+ const next = queue.pop();
11456
+ if (cache.has(next)) continue;
11457
+ cache.add(next);
11458
+ index.childNodes(next).forEach((n22) => queue.push(n22));
11488
11459
  }
11489
- return false;
11460
+ return;
11461
+ }
11462
+ function isParentRemoved(removes, n2, mirror2) {
11463
+ if (removes.size === 0) return false;
11464
+ return _isParentRemoved(removes, n2);
11465
+ }
11466
+ function _isParentRemoved(removes, n2, _mirror) {
11467
+ const node2 = index.parentNode(n2);
11468
+ if (!node2) return false;
11469
+ return removes.has(node2);
11490
11470
  }
11491
11471
  function isAncestorInSet(set, n2) {
11492
11472
  if (set.size === 0) return false;