-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Shorthand for propagating events #638
Comments
It's a good idea! But also I want to see shorthand syntax for preventDefault(). Like: <a href="" on:default:click="set({svelte: 'perfect'})">link</a> |
Rich-Harris
added a commit
that referenced
this issue
Jul 29, 2017
Rich-Harris
added a commit
that referenced
this issue
Jul 29, 2017
Added in 1.27 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This has come up once or twice — since component events don't propagate (unlike DOM events), if you want to listen to an event coming from a deeply nested component you have to propagate the event manually, like so:
I don't think we should automatically bubble events, since that's a potential source of confusion and would mean adding annoying extra code to every component that had nested components. But we could make it a bit less burdensome to manually propagate events with a shorthand syntax:
The text was updated successfully, but these errors were encountered: