From b4fa586ab8c89761396fd5d3581127c29385ecb1 Mon Sep 17 00:00:00 2001 From: Jakub Grzywacz Date: Tue, 17 Dec 2024 10:58:14 +0100 Subject: [PATCH] feat: allow single quote ID wrapper (#2580) # Summary The SVG specification does not strictly standardize linking, and most browsers permit the use of `'` as a wrapper in `url` links. As a result, I've added support for URLs such as `url('#id')`. ## Test Plan `url(#id)` and `url('#id')` should do the exact same thing. Closes #1768 --- src/lib/util.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/util.ts b/src/lib/util.ts index 4284cc3c0..ba10dbbeb 100644 --- a/src/lib/util.ts +++ b/src/lib/util.ts @@ -13,7 +13,7 @@ export function pickNotNil(object: { [prop: string]: unknown }) { return result; } -export const idPattern = /#([^)]+)\)?$/; +export const idPattern = /#([^)]+)'?\)?$/; export const getRandomNumber = () => Math.floor(Math.random() * Math.floor(Math.random() * Date.now()));