mirror of https://github.com/sveltejs/svelte
parent
46c572a14d
commit
da15806136
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'svelte': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
fix: adjust event delegation heuristics
|
@ -0,0 +1,21 @@
|
|||||||
|
import { flushSync } from 'svelte';
|
||||||
|
import { ok, test } from '../../test';
|
||||||
|
|
||||||
|
export default test({
|
||||||
|
test({ assert, component, target, window }) {
|
||||||
|
const button = target.querySelector('button');
|
||||||
|
ok(button);
|
||||||
|
|
||||||
|
flushSync(() => {
|
||||||
|
button.click();
|
||||||
|
});
|
||||||
|
|
||||||
|
assert.deepEqual(component.log, ['1 - 1']);
|
||||||
|
|
||||||
|
flushSync(() => {
|
||||||
|
button.click();
|
||||||
|
});
|
||||||
|
|
||||||
|
assert.deepEqual(component.log, ['1 - 1', '2 - 2']);
|
||||||
|
}
|
||||||
|
});
|
@ -0,0 +1,16 @@
|
|||||||
|
<script>
|
||||||
|
export let log = [];
|
||||||
|
let referenced_directly = 0;
|
||||||
|
let not_referenced_directly = 0;
|
||||||
|
let css_based_on_not_referenced = '';
|
||||||
|
|
||||||
|
function click() {
|
||||||
|
referenced_directly += 1;
|
||||||
|
not_referenced_directly += 1;
|
||||||
|
css_based_on_not_referenced = not_referenced_directly % 2 == 1 ? 'background-color: red' : '';
|
||||||
|
log.push(referenced_directly + ' - ' + not_referenced_directly); //only referenced_directly is increasing
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<button on:click={click} style={css_based_on_not_referenced}> increase both </button>
|
||||||
|
{referenced_directly}
|
Loading…
Reference in new issue