File tree Expand file tree Collapse file tree 1 file changed +7
-8
lines changed
packages/svelte/src/compiler/phases/1-parse Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -49,15 +49,14 @@ export class Parser {
49
49
50
50
this . template = template . trimRight ( ) ;
51
51
52
- const lang_matches = this . template . matchAll ( regex_lang_attribute ) ;
52
+ let match_lang ;
53
53
54
- for ( const match of lang_matches ) {
55
- if ( match [ 0 ] ?. [ 1 ] === 's' ) {
56
- // ensure it starts with '<s' to match script tags
57
- this . ts = match [ 2 ] === 'ts' ;
58
- break ;
59
- }
60
- }
54
+ do match_lang = regex_lang_attribute . exec ( template ) ;
55
+ while ( match_lang && match_lang [ 0 ] [ 1 ] !== 's' ) ; // ensure it starts with '<s' to match script tags
56
+
57
+ regex_lang_attribute . lastIndex = 0 ; // need to reset index to pass tests — otherwise do not use global regex
58
+
59
+ this . ts = match_lang ?. [ 2 ] === 'ts' ;
61
60
62
61
this . root = {
63
62
css : null ,
You can’t perform that action at this time.
0 commit comments