-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
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
Issue when listening to camel case named events in dom templates #4839
Comments
This is due to the exact same reason why props need to be kebab case in in-dom templates: they are converted to all lowercase by the browser before Vue can even parse it. There's literally nothing Vue can do about this - the only workaround is don't use camelCase event names if you use in-dom templates. |
Hi @yyx990803. Yes, I understand the reasons, but why Vue can't do anything about? I could think of establishing an internal case standard and convert all |
Implicit case casting can cause subtle bugs if users emit events with different casing but normalizes to the same string. The simple rule of "never use camelCase" is much more straightforward than any magic casting rules. |
Yes... then the recommended action to support both dom and string templates would be to adapt the events and props names to kebab-case. Thanks for the clarification. |
Hi, I have a component triggering a
clickOut
event, while this works fine using string templates it fails using dom templates. Eg.<my-comp @click-out...
in dom would be ignored while<my-comp @clickOut...
in string works just fine. Same happens with TitleCase events.I understand that Vue converts this cases in the background, reason why I rise this issue. But if I'm wrong and there is something wrong in my approach, please excuse my ignorance.
Fiddle is avaialble.
I would expect that no matter the case applied to the event name, it would work listening to any of it variations or at the very least the kebab-case when using dom templates.
Thank you very much and let me know if you need any additional information.
The text was updated successfully, but these errors were encountered: