- Added pattern const

pull/7914/head
maxiruani 4 years ago
parent b326a4b35f
commit b219f80dd7

@ -8,7 +8,8 @@ import parser_errors from '../errors';
export default function read_style(parser: Parser, start: number, attributes: Node[]): Style { export default function read_style(parser: Parser, start: number, attributes: Node[]): Style {
const content_start = parser.index; 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) { if (parser.index >= parser.template.length) {
parser.error(parser_errors.unclosed_style); 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 // discard styles when css is disabled
if (parser.css_mode === 'none') { if (parser.css_mode === 'none') {
parser.read(/<\/style\s*>/); parser.read(tag_close_pattern);
return null; 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; const end = parser.index;
return { return {

Loading…
Cancel
Save