Skip to content

Commit

Permalink
feat(Snapshot): Capture stylesheets designated as rel="preload"
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewpomeroy committed Dec 12, 2023
1 parent 8aaca89 commit 2327ceb
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions packages/rrweb-snapshot/src/snapshot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1174,11 +1174,12 @@ export function serializeNodeWithId(
}

// <link rel=stylesheet href=...>
if (
serializedNode.type === NodeType.Element &&
if (serializedNode.type === NodeType.Element &&
serializedNode.tagName === 'link' &&
serializedNode.attributes.rel === 'stylesheet'
) {
typeof serializedNode.attributes.rel === 'string' &&
(serializedNode.attributes.rel === 'stylesheet' || (serializedNode.attributes.rel === 'preload' &&
typeof serializedNode.attributes.href === 'string' &&
serializedNode.attributes.href.endsWith('.css')))) {
onceStylesheetLoaded(
n as HTMLLinkElement,
() => {
Expand Down

0 comments on commit 2327ceb

Please sign in to comment.