bodil / typed-html

Type checked JSX for Rust
Mozilla Public License 2.0
1.86k stars 62 forks source link

boolean attribute aren't correctly transformed to valid html #127

Open wwylele opened 1 year ago

wwylele commented 1 year ago

html boolean values are represented by the presence or absence of the attribute (https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#boolean-attributes), which means the following are correct html

<input type=checkbox>
<input type=checkbox disabled>

Additionally html also accepts the following

<input type=checkbox disabled="">   // I don't think the spec made it really clear but my browser interpret this as true
<input type=checkbox disabled="disabled"> // also means true

However, typed-html would generate the following

<input type=checkbox disabled="">  // for false, but this actually means true
<input type=checkbox disabled="true"> // for true, but this is invalid

I have wrote a hacky patch myself to fix this: https://github.com/wwylele/typed-html/commit/658a36f77c2d3d74aaea43baf1aa9b39d2f3e05e