massive-oss / haxe-react

React JS applications development using the Haxe language
196 stars 38 forks source link

Can't use attribute without value in jsx #33

Open mcheshkov opened 8 years ago

mcheshkov commented 8 years ago
jsx('<button disabled>foo</button>');

This gives me Invalid JSX: Expected =, when react itself can handle jsx like that. Easy to work around, but confusing at first.

elsassph commented 8 years ago

Aw right, we're using Haxe's built in XML parser. Needs some patching.

elsassph commented 8 years ago

As far as I can tell this is a limitation of Haxe's (macro time) XML parser. It can't be resolved without using an alternative XML parser. So no short term fix for that.

kevinresol commented 8 years ago

I think a patch in haxe's xml parser will do. https://github.com/HaxeFoundation/haxe/blob/development/std/haxe/xml/Parser.hx

elsassph commented 8 years ago

Mmmh right if the parser is implemented in Haxe already then it might be simple to fix. We thought about having a single parser for JSX instead of making JSX valid XML.

Jarrio commented 7 years ago

If anybody ever comes to this situation the syntax above is incorrect. To use those types of attributes you want to specify the boolean value eg - jsx('<button disabled={true}>foo</button>');