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

jsx: precompile converts props to lowercase #25810

Closed
r-thomson opened this issue Sep 22, 2024 · 2 comments · Fixed by denoland/deno_ast#278 or #25945
Closed

jsx: precompile converts props to lowercase #25810

r-thomson opened this issue Sep 22, 2024 · 2 comments · Fixed by denoland/deno_ast#278 or #25945
Labels
bug Something isn't working correctly jsx-precompile

Comments

@r-thomson
Copy link

Version: Deno 1.45.5

When using JSX with the precompile mode, props are converted to lowercase. This is particularly problematic if you’re working with SVGs, which has case-sensitive attributes.

To test this, I set jsxImportSource to a file that replaces all the JSX functions with console.log. Given the following JSX:

<div someProp="value" />;

With "jsx": "react-jsx":

div { someProp: "value" }

With "jsx": “precompile"

[ '<div someprop="value"></div>' ]
@marvinhagemeister marvinhagemeister added bug Something isn't working correctly jsx-precompile labels Sep 23, 2024
@r-thomson
Copy link
Author

From checking into the code, it looks like this function is responsible for lowercasing the attribute names, so this behavior seems to be intentional.

https://github.com/denoland/deno_ast/blob/e7027f4f7935016b706671ab1ee239c40a55c75e/src/transpiling/jsx_precompile.rs#L89

However, this behavior still absolutely breaks some case-sensitive attributes, like viewBox, so I think it would make sense to rethink this.

@marvinhagemeister
Copy link
Contributor

Reopening until the updated crate is merged here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly jsx-precompile
Projects
None yet
2 participants