Naming convention for on
directive custom events
#13185
-
A "custom event to do stuff" off the Thank you. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
The reason is that properties for these events really exist on elements, so adding an event that way is analogous to just setting those properties.
(See e.g. the interface for Using properties instead of the special I don't think you have to follow the convention for component events; an exception might be forwarding existing DOM events. |
Beta Was this translation helpful? Give feedback.
The reason is that properties for these events really exist on elements, so adding an event that way is analogous to just setting those properties.
(See e.g. the interface for
GlobalEventHandlers
which are implemented byHTMLElement
.)Using properties instead of the special
on:
syntax allows event handlers to be spread in components like any other property. This is helpful for forwarding all events (see #2837