mirror of https://github.com/sveltejs/svelte
fix: improve props spreading logic (#10574)
parent
96eae28ed2
commit
802bfcabec
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"svelte": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
fix: improve props spreading logic
|
@ -0,0 +1,7 @@
|
|||||||
|
<script>
|
||||||
|
let { ...props } = $props();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<button {...props}>
|
||||||
|
Hello world
|
||||||
|
</button>
|
@ -0,0 +1,10 @@
|
|||||||
|
import { test } from '../../test';
|
||||||
|
|
||||||
|
export default test({
|
||||||
|
async test({ assert, target }) {
|
||||||
|
assert.htmlEqual(
|
||||||
|
target.innerHTML,
|
||||||
|
`<button data-attr="">Hello world</button><button data-attr="">Hello world</button>`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
@ -0,0 +1,16 @@
|
|||||||
|
<script>
|
||||||
|
import Button from "./Button.svelte";
|
||||||
|
|
||||||
|
const attrs = {};
|
||||||
|
|
||||||
|
Object.defineProperty(attrs, "data-attr", {
|
||||||
|
value: "",
|
||||||
|
enumerable: true
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<button {...attrs}>
|
||||||
|
Hello world
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<Button {...attrs} />
|
Loading…
Reference in new issue