mirror of
https://github.com/sveltejs/svelte.git
synced 2024-11-21 11:28:58 +01:00
fix: allow svelte:self in snippets (#9439)
* fix: allow svelte:self in snippets * Create funny-wombats-argue.md
This commit is contained in:
parent
73ae5ef5bc
commit
e90ded677e
5
.changeset/funny-wombats-argue.md
Normal file
5
.changeset/funny-wombats-argue.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
"svelte": patch
|
||||
---
|
||||
|
||||
fix: allow svelte:self in snippets
|
@ -141,7 +141,7 @@ const special_elements = {
|
||||
/** @param {string} name */
|
||||
'duplicate-svelte-element': (name) => `A component can only have one <${name}> element`,
|
||||
'invalid-self-placement': () =>
|
||||
`<svelte:self> components can only exist inside {#if} blocks, {#each} blocks, or slots passed to components`,
|
||||
`<svelte:self> components can only exist inside {#if} blocks, {#each} blocks, {#snippet} blocks or slots passed to components`,
|
||||
'missing-svelte-element-definition': () => `<svelte:element> must have a 'this' attribute`,
|
||||
'missing-svelte-component-definition': () => `<svelte:component> must have a 'this' attribute`,
|
||||
'invalid-svelte-element-definition': () => `Invalid element definition — must be an {expression}`,
|
||||
|
@ -333,7 +333,8 @@ function read_tag_name(parser) {
|
||||
if (
|
||||
fragment.type === 'IfBlock' ||
|
||||
fragment.type === 'EachBlock' ||
|
||||
fragment.type === 'Component'
|
||||
fragment.type === 'Component' ||
|
||||
fragment.type === 'SnippetBlock'
|
||||
) {
|
||||
legal = true;
|
||||
break;
|
||||
|
@ -4,7 +4,7 @@ export default test({
|
||||
error: {
|
||||
code: 'invalid-self-placement',
|
||||
message:
|
||||
'<svelte:self> components can only exist inside {#if} blocks, {#each} blocks, or slots passed to components',
|
||||
'<svelte:self> components can only exist inside {#if} blocks, {#each} blocks,, {#snippet} blocks or slots passed to components',
|
||||
position: [1, 1]
|
||||
}
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user