Skip to content
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

Support events without hyphens (?) #32

Open
nolanlawson opened this issue Aug 16, 2020 · 3 comments
Open

Support events without hyphens (?) #32

nolanlawson opened this issue Aug 16, 2020 · 3 comments
Labels
enhancement New feature or request

Comments

@nolanlawson
Copy link
Owner

It's come to my attention that the event names skin-tone-change and emoji-click may be problematic in some cases. It looks like some frameworks may not be able to use anything but lowercase, non-hyphenated event names, because that's what's supported in the DOM. E.g.:

<emoji-picker onemojiclick></emoji-picker>

but not

<emoji-picker onemoji-click></emoji-picker>

The second one looks like of bizarre anyway, so we should probably just support the non-hyphenated version, and maybe remove the hyphenated version in a major update later.

Note this would only apply to declarative usage not imperative usage. element.addEventListener() should work in all cases.

@nolanlawson nolanlawson added the enhancement New feature or request label Aug 16, 2020
@nolanlawson
Copy link
Owner Author

Prior art:

Seems LWC and Google both agree on lowercase, no hyphens at least.

@nolanlawson
Copy link
Owner Author

I suppose there's also the question of whether I should have picker.onemojiclick and picker.onskintonechange as properties.

@nolanlawson
Copy link
Owner Author

Looking back through custom elements everywhere, it appears there are actually no tested frameworks that support lowercase events but not lowercase-kebab events.

Also, apparently onsomeevent is not a thing? file-drop adds some TypeScript annotations for JSX, but I assume this is just for Preact since React doesn't support any declarative events on custom elements whatsoever.

So maybe it is not a big deal to implement this.

@nolanlawson nolanlawson changed the title Support events without hyphens Support events without hyphens (?) Aug 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant