Skip to content

Commit d1e0298

Browse files
committed
desc
1 parent 3bcb337 commit d1e0298

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

.changeset/hip-balloons-begin.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
'svelte': patch
33
---
44

5-
fix: improve script `lang` attribute matching
5+
fix: improve script `lang` attribute detection

packages/svelte/src/compiler/phases/1-parse/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export class Parser {
5454
do match_lang = regex_lang_attribute.exec(template);
5555
while (match_lang && match_lang[0][1] !== 's'); // ensure it starts with '<s' to match script tags
5656

57-
regex_lang_attribute.lastIndex = 0; // need to reset index to pass tests otherwise do not use global regex
57+
regex_lang_attribute.lastIndex = 0; // reset matched index to pass tests - otherwise declare the regex inside the constructor
5858

5959
this.ts = match_lang?.[2] === 'ts';
6060

0 commit comments

Comments
 (0)