From 2f06776d418a77c42b0d9e0956b9b0d97b35a7c4 Mon Sep 17 00:00:00 2001 From: Taku Amano <taku@taaas.jp> Date: Sat, 23 Nov 2024 05:55:23 +0900 Subject: [PATCH] fix(helper/css): Update regex to match nonce attribute --- src/helper/css/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/helper/css/index.ts b/src/helper/css/index.ts index 417923afc..4f0e7d669 100644 --- a/src/helper/css/index.ts +++ b/src/helper/css/index.ts @@ -63,7 +63,7 @@ export const createCssContext = ({ id }: { id: Readonly<string> }): DefaultConte const contextMap: WeakMap<object, usedClassNameData> = new WeakMap() - const replaceStyleRe = new RegExp(`(<style id="${id}">.*?)(</style>)`) + const replaceStyleRe = new RegExp(`(<style id="${id}"(?: nonce="[^"]*")?>.*?)(</style>)`) const newCssClassNameObject = (cssClassName: CssClassNameCommon): Promise<string> => { const appendStyle: HtmlEscapedCallback = ({ buffer, context }): Promise<string> | undefined => {