mirror of https://github.com/sveltejs/svelte
fix: handle non-string values in svelte:element this attribute (#17499)
* fix: handle non-string values in svelte:element this attribute * chore: add changeset * fix(review): throw error in DEV for invalid svelte:element tag, ignore in PROD * chore: remove unused expected.html from test * fix(review): refine validate.js logic * fix(review): use else if (string) logic in server/index.js * fix(review): swap validation order in compiler, revert runtime changes * test: move reproduction to runtime-legacy per review * Apply suggestion from @7nik --------- Co-authored-by: tensorworker <tensorworker@proton.me> Co-authored-by: 7nik <kfiiranet@gmail.com>pull/17508/head
parent
c9ebd6a885
commit
d3776c1723
@ -0,0 +1,5 @@
|
||||
---
|
||||
"svelte": patch
|
||||
---
|
||||
|
||||
fix: handle non-string values in `svelte:element` `this` attribute
|
||||
@ -0,0 +1,17 @@
|
||||
import { test } from '../../test';
|
||||
|
||||
export default test({
|
||||
mode: ['client', 'server'],
|
||||
|
||||
compileOptions: {
|
||||
dev: true
|
||||
},
|
||||
|
||||
get props() {
|
||||
return { tag: true };
|
||||
},
|
||||
|
||||
error:
|
||||
'svelte_element_invalid_this_value\n' +
|
||||
'The `this` prop on `<svelte:element>` must be a string, if defined'
|
||||
});
|
||||
@ -0,0 +1,5 @@
|
||||
<script>
|
||||
export let tag;
|
||||
</script>
|
||||
|
||||
<svelte:element this={tag}>content</svelte:element>
|
||||
Loading…
Reference in new issue