@posthog/rrweb 0.0.19 → 0.0.21

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.
@@ -283,9 +283,13 @@ function stringifyStylesheet(s2) {
283
283
  if (!rules2) {
284
284
  return null;
285
285
  }
286
+ let sheetHref = s2.href;
287
+ if (!sheetHref && s2.ownerNode && s2.ownerNode.ownerDocument) {
288
+ sheetHref = s2.ownerNode.ownerDocument.baseURI;
289
+ }
286
290
  const stringifiedRules = Array.from(
287
291
  rules2,
288
- (rule2) => stringifyRule(rule2, s2.href)
292
+ (rule2) => stringifyRule(rule2, sheetHref)
289
293
  ).join("");
290
294
  return fixBrowserCompatibilityIssuesInCSS(stringifiedRules);
291
295
  } catch (error) {
@@ -293,6 +297,7 @@ function stringifyStylesheet(s2) {
293
297
  }
294
298
  }
295
299
  function stringifyRule(rule2, sheetHref) {
300
+ var _a2;
296
301
  if (isCSSImportRule(rule2)) {
297
302
  let importStringified;
298
303
  try {
@@ -303,8 +308,11 @@ function stringifyRule(rule2, sheetHref) {
303
308
  } catch (error) {
304
309
  importStringified = rule2.cssText;
305
310
  }
306
- if (rule2.styleSheet.href) {
307
- return absolutifyURLs(importStringified, rule2.styleSheet.href);
311
+ try {
312
+ if (importStringified && ((_a2 = rule2.styleSheet) == null ? void 0 : _a2.href)) {
313
+ return absolutifyURLs(importStringified, rule2.styleSheet.href);
314
+ }
315
+ } catch (e2) {
308
316
  }
309
317
  return importStringified;
310
318
  } else {
@@ -5437,6 +5445,16 @@ function createCache() {
5437
5445
  stylesWithHoverClass
5438
5446
  };
5439
5447
  }
5448
+ function safeDocNode(n2, options) {
5449
+ let stringContent = n2.textContent;
5450
+ if (n2.isStyle && options.hackCss) {
5451
+ try {
5452
+ stringContent = adaptCssForReplay(n2.textContent, options.cache);
5453
+ } catch (e2) {
5454
+ }
5455
+ }
5456
+ return options.doc.createTextNode(stringContent);
5457
+ }
5440
5458
  function buildNode(n2, options) {
5441
5459
  var _a2;
5442
5460
  const { doc, hackCss, cache } = options;
@@ -5585,9 +5603,11 @@ function buildNode(n2, options) {
5585
5603
  return node2;
5586
5604
  }
5587
5605
  case NodeType$1$1.Text:
5588
- return doc.createTextNode(
5589
- n2.isStyle && hackCss ? adaptCssForReplay(n2.textContent, cache) : n2.textContent
5590
- );
5606
+ return safeDocNode(n2, {
5607
+ cache,
5608
+ doc,
5609
+ hackCss
5610
+ });
5591
5611
  case NodeType$1$1.CDATA:
5592
5612
  if (n2.textContent.trim() === "") {
5593
5613
  return null;