mirror of https://github.com/sveltejs/svelte
fix: exclude internal props from spread attributes (#9384)
* exclude internal props from spread attributes * changeset * tighten up --------- Co-authored-by: Rich Harris <rich.harris@vercel.com>pull/9388/head
parent
51394a4834
commit
2aacfad9ae
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'svelte': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
fix: exclude internal props from spread attributes
|
@ -0,0 +1,7 @@
|
|||||||
|
<script>
|
||||||
|
let { ...stuff } = $props();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<button {...stuff} on:click>
|
||||||
|
<slot></slot>
|
||||||
|
</button>
|
@ -0,0 +1,13 @@
|
|||||||
|
import { test } from '../../test';
|
||||||
|
|
||||||
|
export default test({
|
||||||
|
html: `<button>clicks: 0</button>`,
|
||||||
|
|
||||||
|
async test({ assert, target }) {
|
||||||
|
const button = target.querySelector('button');
|
||||||
|
|
||||||
|
button?.click();
|
||||||
|
await Promise.resolve();
|
||||||
|
assert.htmlEqual(target.innerHTML, '<button>clicks: 1</button>');
|
||||||
|
}
|
||||||
|
});
|
@ -0,0 +1,13 @@
|
|||||||
|
<script>
|
||||||
|
import Button from './Button.svelte';
|
||||||
|
|
||||||
|
let count = $state(0);
|
||||||
|
|
||||||
|
function increment() {
|
||||||
|
count += 1;
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<Button on:click={increment}>
|
||||||
|
clicks: {count}
|
||||||
|
</Button>
|
Loading…
Reference in new issue