Extend to run fixBrowserCompatibilityIssuesInCSS over inline stylesheets (#1279)
* Extend to run fixBrowserCompatibilityIssuesInCSS over styles in inline style sheets * Apply formatting changes --------- Co-authored-by: eoghanmurray <eoghanmurray@users.noreply.github.com>
This commit is contained in:
6
.changeset/curvy-apples-lay.md
Normal file
6
.changeset/curvy-apples-lay.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
'rrweb-snapshot': patch
|
||||
'rrweb': patch
|
||||
---
|
||||
|
||||
Extend to run fixBrowserCompatibilityIssuesInCSS over inline stylesheets
|
||||
@@ -51,16 +51,6 @@ function getValidTagName(element: HTMLElement): Lowercase<string> {
|
||||
return processedTagName;
|
||||
}
|
||||
|
||||
function stringifyStyleSheet(sheet: CSSStyleSheet): string {
|
||||
return sheet.cssRules
|
||||
? Array.from(sheet.cssRules)
|
||||
.map((rule) =>
|
||||
rule.cssText ? validateStringifiedCssRule(rule.cssText) : '',
|
||||
)
|
||||
.join('')
|
||||
: '';
|
||||
}
|
||||
|
||||
function extractOrigin(url: string): string {
|
||||
let origin = '';
|
||||
if (url.indexOf('//') > -1) {
|
||||
@@ -564,7 +554,7 @@ function serializeTextNode(
|
||||
// to _only_ include the current rule(s) added by the text node.
|
||||
// So we'll be conservative and keep textContent as-is.
|
||||
} else if ((n.parentNode as HTMLStyleElement).sheet?.cssRules) {
|
||||
textContent = stringifyStyleSheet(
|
||||
textContent = getCssRulesString(
|
||||
(n.parentNode as HTMLStyleElement).sheet!,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -5503,10 +5503,15 @@ csso@^4.0.2:
|
||||
dependencies:
|
||||
css-tree "^1.1.2"
|
||||
|
||||
cssom@^0.4.4, cssom@^0.5.0, "cssom@https://registry.npmjs.org/rrweb-cssom/-/rrweb-cssom-0.6.0.tgz":
|
||||
cssom@^0.4.4, "cssom@https://registry.npmjs.org/rrweb-cssom/-/rrweb-cssom-0.6.0.tgz":
|
||||
version "0.6.0"
|
||||
resolved "https://registry.npmjs.org/rrweb-cssom/-/rrweb-cssom-0.6.0.tgz#ed298055b97cbddcdeb278f904857629dec5e0e1"
|
||||
|
||||
cssom@^0.5.0:
|
||||
version "0.5.0"
|
||||
resolved "https://registry.yarnpkg.com/cssom/-/cssom-0.5.0.tgz#d254fa92cd8b6fbd83811b9fbaed34663cc17c36"
|
||||
integrity sha512-iKuQcq+NdHqlAcwUY0o/HL69XQrUaQdMjmStJ8JFmUaiiQErlhrmuigkg/CU4E2J0IyUKUrMAgl36TvN67MqTw==
|
||||
|
||||
cssom@~0.3.6:
|
||||
version "0.3.8"
|
||||
resolved "https://registry.yarnpkg.com/cssom/-/cssom-0.3.8.tgz#9f1276f5b2b463f2114d3f2c75250af8c1a36f4a"
|
||||
|
||||
Reference in New Issue
Block a user