Skip to content

Commit

Permalink
Fixup for background-clip replacement (rrweb-io#1476)
Browse files Browse the repository at this point in the history
* Fix that the `.replace()` function only replaces the first occurrence

* This should have been included in rrweb-io#1174

* Create fast-pets-exist.md
  • Loading branch information
eoghanmurray authored and jxiwang committed Jul 31, 2024
1 parent bb36c98 commit d12234d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .changeset/fast-pets-exist.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"rrweb-snapshot": patch
"rrweb": patch
---

Fixup for multiple background-clip replacement
2 changes: 1 addition & 1 deletion packages/rrweb-snapshot/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ function fixBrowserCompatibilityIssuesInCSS(cssText: string): string {
!cssText.includes(' -webkit-background-clip: text;')
) {
cssText = cssText.replace(
' background-clip: text;',
/\sbackground-clip:\s*text;/g,
' -webkit-background-clip: text; background-clip: text;',
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,12 @@ exports[`integration tests [html file]: picture-in-frame.html 1`] = `
</body></html>"
`;
exports[`integration tests [html file]: picture-with-inline-onload.html 1`] = `
"<html xmlns=\\"http://www.w3.org/1999/xhtml\\"><head></head><body>
<img src=\\"http://localhost:3030/images/robot.png\\" alt=\\"This is a robot\\" style=\\"opacity: 1;\\" _onload=\\"this.style.opacity=1\\" />
</body></html>"
`;

exports[`integration tests [html file]: preload.html 1`] = `
"<!DOCTYPE html><html lang=\\"en\\"><head>
<meta charset=\\"UTF-8\\" />
Expand Down

0 comments on commit d12234d

Please sign in to comment.