-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: ignore expressions in top level script/style tag attributes (#9498)
Related to sveltejs/language-tools#2204 / sveltejs/language-tools#2039
- Loading branch information
1 parent
2ea1764
commit 9a97d5c
Showing
4 changed files
with
196 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'svelte': patch | ||
--- | ||
|
||
fix: ignore expressions in top level script/style tag attributes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
packages/svelte/test/parser/samples/script-attribute-with-curly-braces/input.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<script generics="T extends { yes: boolean }"> | ||
let name = 'world'; | ||
</script> | ||
|
||
<h1>Hello {name}!</h1> |
150 changes: 150 additions & 0 deletions
150
packages/svelte/test/parser/samples/script-attribute-with-curly-braces/output.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,150 @@ | ||
{ | ||
"html": { | ||
"start": 79, | ||
"end": 101, | ||
"type": "Fragment", | ||
"children": [ | ||
{ | ||
"start": 77, | ||
"end": 79, | ||
"type": "Text", | ||
"raw": "\n\n", | ||
"data": "\n\n" | ||
}, | ||
{ | ||
"start": 79, | ||
"end": 101, | ||
"type": "Element", | ||
"name": "h1", | ||
"attributes": [], | ||
"children": [ | ||
{ | ||
"start": 83, | ||
"end": 89, | ||
"type": "Text", | ||
"raw": "Hello ", | ||
"data": "Hello " | ||
}, | ||
{ | ||
"start": 89, | ||
"end": 95, | ||
"type": "MustacheTag", | ||
"expression": { | ||
"type": "Identifier", | ||
"start": 90, | ||
"end": 94, | ||
"loc": { | ||
"start": { | ||
"line": 5, | ||
"column": 11 | ||
}, | ||
"end": { | ||
"line": 5, | ||
"column": 15 | ||
} | ||
}, | ||
"name": "name" | ||
} | ||
}, | ||
{ | ||
"start": 95, | ||
"end": 96, | ||
"type": "Text", | ||
"raw": "!", | ||
"data": "!" | ||
} | ||
] | ||
} | ||
] | ||
}, | ||
"instance": { | ||
"type": "Script", | ||
"start": 0, | ||
"end": 77, | ||
"context": "default", | ||
"content": { | ||
"type": "Program", | ||
"start": 46, | ||
"end": 68, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 0 | ||
}, | ||
"end": { | ||
"line": 3, | ||
"column": 0 | ||
} | ||
}, | ||
"body": [ | ||
{ | ||
"type": "VariableDeclaration", | ||
"start": 48, | ||
"end": 67, | ||
"loc": { | ||
"start": { | ||
"line": 2, | ||
"column": 1 | ||
}, | ||
"end": { | ||
"line": 2, | ||
"column": 20 | ||
} | ||
}, | ||
"declarations": [ | ||
{ | ||
"type": "VariableDeclarator", | ||
"start": 52, | ||
"end": 66, | ||
"loc": { | ||
"start": { | ||
"line": 2, | ||
"column": 5 | ||
}, | ||
"end": { | ||
"line": 2, | ||
"column": 19 | ||
} | ||
}, | ||
"id": { | ||
"type": "Identifier", | ||
"start": 52, | ||
"end": 56, | ||
"loc": { | ||
"start": { | ||
"line": 2, | ||
"column": 5 | ||
}, | ||
"end": { | ||
"line": 2, | ||
"column": 9 | ||
} | ||
}, | ||
"name": "name" | ||
}, | ||
"init": { | ||
"type": "Literal", | ||
"start": 59, | ||
"end": 66, | ||
"loc": { | ||
"start": { | ||
"line": 2, | ||
"column": 12 | ||
}, | ||
"end": { | ||
"line": 2, | ||
"column": 19 | ||
} | ||
}, | ||
"value": "world", | ||
"raw": "'world'" | ||
} | ||
} | ||
], | ||
"kind": "let" | ||
} | ||
], | ||
"sourceType": "module" | ||
} | ||
} | ||
} |