Skip to content

Commit c2a495c

Browse files
committed
fix: adjust regex
would error on non-quoted attributes with more than one character
1 parent b966470 commit c2a495c

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

.changeset/wicked-clouds-exercise.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'svelte': patch
3+
---
4+
5+
fix: adjust regex

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import read_options from './read/options.js';
1111
const regex_position_indicator = / \(\d+:\d+\)$/;
1212

1313
const regex_lang_attribute =
14-
/<!--[^]*?-->|<script\s+(?:[^>]*|(?:[^=>'"/]+=(?:"[^"]*"|'[^']*'|[^>\s])\s+)*)lang=(["'])?([^"' >]+)\1[^>]*>/;
14+
/<!--[^]*?-->|<script\s+(?:[^>]*|(?:[^=>'"/]+=(?:"[^"]*"|'[^']*'|[^>\s]+)\s+)*)lang=(["'])?([^"' >]+)\1[^>]*>/;
1515

1616
export class Parser {
1717
/**

0 commit comments

Comments
 (0)