Skip to content

Commit

Permalink
The _cssTextSplits should only apply to <style> elements
Browse files Browse the repository at this point in the history
  • Loading branch information
eoghanmurray committed May 7, 2024
1 parent ee6c028 commit 4cf6b73
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions packages/rrweb-snapshot/src/snapshot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,13 @@ function serializeElementNode(
);
if (cssText) {
attributes._cssText = absoluteToStylesheet(cssText, getHref());
if (n.childNodes.length > 1) {
const splits = findCssTextSplits(
attributes._cssText,
n as HTMLStyleElement,
);
attributes._cssTextSplits = splits.join(' ');
}
}
}
// form fields
Expand Down Expand Up @@ -1110,13 +1117,6 @@ export function serializeNodeWithId(
typeof serializedNode.attributes._cssText === 'string'
) {
bypassOptions.blankTextNodes = true;
if (n.childNodes.length > 1) {
const splits = findCssTextSplits(
serializedNode.attributes._cssText,
n as HTMLStyleElement,
);
serializedNode.attributes._cssTextSplits = splits.join(' ');
}
}
for (const childN of Array.from(n.childNodes)) {
const serializedChildNode = serializeNodeWithId(childN, bypassOptions);
Expand Down

0 comments on commit 4cf6b73

Please sign in to comment.