wix-incubator / react-templates

Light weight templates for react
https://wix.github.io/react-templates
MIT License
2.82k stars 207 forks source link

attribute empty-string is translated into 'true' #224

Open imbroglioj opened 7 years ago

imbroglioj commented 7 years ago

When an attribute like href or placeholder is assigned the empty string; react-templates replaces the empty string with true Example: placeholder="" --> {... placeholder: true ...} A workaround is to enclose the empty-string in curly braces: {""}. (Coming from Angular, I've become a big fan of react-templates in the last couple days. The amount of empty boilerplate and crufty JSX+JS it replaces is impressive. And the ability to step through the resulting rt.js for debugging is a lifesaver.)

nippur72 commented 7 years ago

they are translated into true in order to support boolean attributes, e.g.:

<input disabled />   <!-- becomes: disabled=true -->

This because in HTML <input disabled /> and <input disabled="" /> are the same thing.