Skip to content

Commit cbbd1e5

Browse files
authored
Fixup for background-clip replacement (#1476)
* Fix that the `.replace()` function only replaces the first occurrence * This should have been included in #1174 * Create fast-pets-exist.md
1 parent 26c331b commit cbbd1e5

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

.changeset/fast-pets-exist.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"rrweb-snapshot": patch
3+
"rrweb": patch
4+
---
5+
6+
Fixup for multiple background-clip replacement

packages/rrweb-snapshot/src/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ function fixBrowserCompatibilityIssuesInCSS(cssText: string): string {
4747
!cssText.includes(' -webkit-background-clip: text;')
4848
) {
4949
cssText = cssText.replace(
50-
' background-clip: text;',
50+
/\sbackground-clip:\s*text;/g,
5151
' -webkit-background-clip: text; background-clip: text;',
5252
);
5353
}

packages/rrweb-snapshot/test/__snapshots__/integration.test.ts.snap

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,12 @@ exports[`integration tests [html file]: picture-in-frame.html 1`] = `
364364
</body></html>"
365365
`;
366366
367+
exports[`integration tests [html file]: picture-with-inline-onload.html 1`] = `
368+
"<html xmlns=\\"http://www.w3.org/1999/xhtml\\"><head></head><body>
369+
<img src=\\"http://localhost:3030/images/robot.png\\" alt=\\"This is a robot\\" style=\\"opacity: 1;\\" _onload=\\"this.style.opacity=1\\" />
370+
</body></html>"
371+
`;
372+
367373
exports[`integration tests [html file]: preload.html 1`] = `
368374
"<!DOCTYPE html><html lang=\\"en\\"><head>
369375
<meta charset=\\"UTF-8\\" />

0 commit comments

Comments
 (0)