From b219f80dd731af7cc2c869758413ee403c99b023 Mon Sep 17 00:00:00 2001 From: maxiruani Date: Thu, 6 Oct 2022 18:26:45 -0300 Subject: [PATCH] - Added pattern const --- src/compiler/parse/read/style.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/compiler/parse/read/style.ts b/src/compiler/parse/read/style.ts index 15e77d2ff6..c4788466ec 100644 --- a/src/compiler/parse/read/style.ts +++ b/src/compiler/parse/read/style.ts @@ -8,7 +8,8 @@ import parser_errors from '../errors'; export default function read_style(parser: Parser, start: number, attributes: Node[]): Style { const content_start = parser.index; - const styles = parser.read_until(/<\/style\s*>/, parser_errors.unclosed_style); + const tag_close_pattern = /<\/style\s*>/; + const styles = parser.read_until(tag_close_pattern, parser_errors.unclosed_style); if (parser.index >= parser.template.length) { parser.error(parser_errors.unclosed_style); @@ -18,7 +19,7 @@ export default function read_style(parser: Parser, start: number, attributes: No // discard styles when css is disabled if (parser.css_mode === 'none') { - parser.read(/<\/style\s*>/); + parser.read(tag_close_pattern); return null; } @@ -73,7 +74,7 @@ export default function read_style(parser: Parser, start: number, attributes: No } }); - parser.read(/<\/style\s*>/); + parser.read(tag_close_pattern); const end = parser.index; return {