File tree Expand file tree Collapse file tree 5 files changed +19
-2
lines changed
test/preprocess/samples/attributes-with-closing-tag Expand file tree Collapse file tree 5 files changed +19
-2
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ ' svelte ' : patch
3
+ ---
4
+
5
+ fix: handle closing tags inside attribute values
Original file line number Diff line number Diff line change @@ -252,8 +252,10 @@ function stringify_tag_attributes(attributes) {
252
252
return value ;
253
253
}
254
254
255
- const regex_style_tags = / < ! - - [ ^ ] * ?- - > | < s t y l e ( \s [ ^ ] * ?) ? (?: > ( [ ^ ] * ?) < \/ s t y l e > | \/ > ) / gi;
256
- const regex_script_tags = / < ! - - [ ^ ] * ?- - > | < s c r i p t ( \s [ ^ ] * ?) ? (?: > ( [ ^ ] * ?) < \/ s c r i p t > | \/ > ) / gi;
255
+ const regex_style_tags =
256
+ / < ! - - [ ^ ] * ?- - > | < s t y l e ( (?: \s + [ ^ = > ' " \/ ] + = (?: " [ ^ " ] * " | ' [ ^ ' ] * ' | [ ^ > \s ] ) | \s + [ ^ = > ' " \/ ] + ) * \s * ) (?: \/ > | > ( [ \S \s ] * ?) < \/ s t y l e > ) / g;
257
+ const regex_script_tags =
258
+ / < ! - - [ ^ ] * ?- - > | < s c r i p t ( (?: \s + [ ^ = > ' " \/ ] + = (?: " [ ^ " ] * " | ' [ ^ ' ] * ' | [ ^ > \s ] ) | \s + [ ^ = > ' " \/ ] + ) * \s * ) (?: \/ > | > ( [ \S \s ] * ?) < \/ s c r i p t > ) / g;
257
259
258
260
/**
259
261
* Calculate the updates required to process all instances of the specified tag.
Original file line number Diff line number Diff line change
1
+ export default {
2
+ preprocess : {
3
+ script : ( { attributes } ) =>
4
+ attributes . generics && attributes . generics . includes ( '>' ) ? { code : '' } : null
5
+ }
6
+ } ;
Original file line number Diff line number Diff line change
1
+ <script generics =" T extends Record<string, string>" >
2
+ foo {}
3
+ </script >
Original file line number Diff line number Diff line change
1
+ <script generics =" T extends Record<string, string>" ></script >
You can’t perform that action at this time.
0 commit comments