Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use includes over contains #1275

Merged
merged 1 commit into from
Jun 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions patches/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -224,20 +224,22 @@ index da2c103fe6b1408a5996f0eb3bf047571e434cc2..f5b060c7e0728a3e2c6cf62b01d97282
}, [bitmap]);
}));
diff --git a/es/rrweb/packages/rrweb-snapshot/es/rrweb-snapshot.js b/es/rrweb/packages/rrweb-snapshot/es/rrweb-snapshot.js
index 0fc7d4bcafc9be822347f9437658478fd77d9972..a2400dbd745664cc94335f9a0d04bb52af91ee13 100644
index 0fc7d4bcafc9be822347f9437658478fd77d9972..5dcd1dcbd5380567110378269f3bc8d7b7ca6440 100644
--- a/es/rrweb/packages/rrweb-snapshot/es/rrweb-snapshot.js
+++ b/es/rrweb/packages/rrweb-snapshot/es/rrweb-snapshot.js
@@ -641,9 +641,17 @@ function serializeElementNode(n, options) {
@@ -641,9 +641,18 @@ function serializeElementNode(n, options) {
}
}
if (tagName === 'link' && inlineStylesheet) {
- const stylesheet = Array.from(doc.styleSheets).find((s) => {
- return s.href === n.href;
+ const href = n.href
+ let stylesheet = Array.from(doc.styleSheets).find((s) => {
return s.href === n.href;
+ return s.href === href;
});
+ if (!stylesheet && n.href.contains('.css')) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not part of the mozilla spec at least https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String so probably depends on browser yeah

+ if (!stylesheet && href.includes('.css')) {
marandaneto marked this conversation as resolved.
Show resolved Hide resolved
+ const rootDomain = window.location.origin
+ const stylesheetPath = n.href.replace(window.location.href, '')
+ const stylesheetPath = href.replace(window.location.href, '')
+ const potentialStylesheetHref = rootDomain + '/' + stylesheetPath
+ stylesheet = Array.from(doc.styleSheets).find((s) => {
+ return s.href === potentialStylesheetHref;
Expand Down
6 changes: 3 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading