denoland / deno_ast

Source text parsing, lexing, and AST related functionality for Deno
https://crates.io/crates/deno_ast
MIT License
146 stars 45 forks source link

fix: only optimize known boolean jsx attrs #184

Closed marvinhagemeister closed 10 months ago

marvinhagemeister commented 10 months ago

In the new JSX transform we have an optimization that bypasses jsxAttr with boolean attributes.

// input
<input type="checkbox" checked />

// output
const tpl = [`<input type="checkbox" checked>`]
jsxTemplate(tpl);

But we can only apply this optimization for known HTML boolean attributes. If it's not part of the boolean attributes in the HTML spec, then we should always fall back to jsxAttr, because it might be something framework specific.

Ran into this while trying to switch the Fresh size over to the precompile transform.