Skip to content

Commit 8bf7c1e

Browse files
committed
fix: handle unicode ids in css escape fallback
1 parent 0013094 commit 8bf7c1e

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

__tests__/unit/exporter/svg.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ describe('exporter/svg', () => {
245245
expect(exportedRect?.getAttribute('fill')).not.toContain('url(#');
246246
});
247247

248-
it.each(['1grad', '-1grad'])(
248+
it.each(['1grad', '-1grad', '💡grad'])(
249249
'inlines defs references for ids requiring CSS.escape fallback (%s)',
250250
async (gradientId) => {
251251
const originalCSS = globalThis.CSS;

src/exporter/svg.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -561,6 +561,7 @@ function cssEscape(value: string): string {
561561

562562
// Characters that are safe to use unescaped
563563
if (
564+
codeUnit >= 0x0080 ||
564565
(codeUnit >= 0x0030 && codeUnit <= 0x0039) || // 0-9
565566
(codeUnit >= 0x0041 && codeUnit <= 0x005a) || // A-Z
566567
(codeUnit >= 0x0061 && codeUnit <= 0x007a) || // a-z

0 commit comments

Comments
 (0)