mirror of https://github.com/sveltejs/svelte
fix: improve event delegation with shadowed bindings (#10620)
* fix: improve event delegation with shadowed bindings * fix: improve event delegation with shadowed bindingspull/10622/head
parent
351d463bc4
commit
b4a70ea38a
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"svelte": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
fix: improve event delegation with shadowed bindings
|
@ -0,0 +1,16 @@
|
|||||||
|
import { test } from '../../test';
|
||||||
|
import { log } from './log.js';
|
||||||
|
|
||||||
|
export default test({
|
||||||
|
before_test() {
|
||||||
|
log.length = 0;
|
||||||
|
},
|
||||||
|
|
||||||
|
async test({ assert, target }) {
|
||||||
|
const btn = target.querySelector('button');
|
||||||
|
|
||||||
|
btn?.click();
|
||||||
|
await Promise.resolve();
|
||||||
|
assert.deepEqual(log, ['method']);
|
||||||
|
}
|
||||||
|
});
|
@ -0,0 +1,2 @@
|
|||||||
|
/** @type {any[]} */
|
||||||
|
export const log = [];
|
@ -0,0 +1,12 @@
|
|||||||
|
<script>
|
||||||
|
import { log } from './log.js';
|
||||||
|
|
||||||
|
let method = $state('method');
|
||||||
|
function submitPay() {
|
||||||
|
log.push(method);
|
||||||
|
}
|
||||||
|
let methods = [{method:1}];
|
||||||
|
</script>
|
||||||
|
{#each methods as {method}}
|
||||||
|
<button onclick={submitPay}>{method}</button>
|
||||||
|
{/each}
|
Loading…
Reference in new issue