mirror of https://github.com/sveltejs/svelte
fix: allow events to continue propagating following an error (#11263)
* fix: allow events to continue propagating following an error * test * appease eslintpull/11260/head
parent
9721d5641b
commit
521d124267
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'svelte': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
fix: allow events to continue propagating following an error
|
@ -0,0 +1,15 @@
|
|||||||
|
import { flushSync } from 'svelte';
|
||||||
|
import { test } from '../../test';
|
||||||
|
|
||||||
|
export default test({
|
||||||
|
html: `<div><button>0 0</button>`,
|
||||||
|
|
||||||
|
async test({ assert, target }) {
|
||||||
|
const button1 = target.querySelector('button');
|
||||||
|
|
||||||
|
flushSync(() => button1?.click());
|
||||||
|
assert.htmlEqual(target.innerHTML, `<div><button>1 1</button></div>`);
|
||||||
|
},
|
||||||
|
|
||||||
|
runtime_error: 'nope'
|
||||||
|
});
|
@ -0,0 +1,19 @@
|
|||||||
|
<script>
|
||||||
|
let y = $state(0);
|
||||||
|
let n = $state(0);
|
||||||
|
|
||||||
|
function yep() {
|
||||||
|
y += 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
function nope() {
|
||||||
|
n += 1;
|
||||||
|
throw new Error('nope');
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div onclick={yep}>
|
||||||
|
<button onclick={nope}>
|
||||||
|
{y} {n}
|
||||||
|
</button>
|
||||||
|
</div>
|
Loading…
Reference in new issue