facebook/react — pull request #1514 by syranide (2014-05-11 12:00:49+00:00)
Title: Unescape XHTML entities in JSX literals (moved from parser)

We discussed this briefly some time ago, because ` ` is unescaped in the parser and JSX receives no information about it, it ends up being identical to just ` ` which is trimmed by JSX if appearing left/right-most on a line.

Here's a simple proposal that moves the unescaping from the parser to JSX, I also made the unescaping routine a bit more accurate while also making it lenient like browsers, so `XJS & JSX` is valid (`XJS & JSX` is quite cumbersome and annoying).

Alternative implementation could have the parser parse both `XJSText` and `XJSEntity` for instance, and introducing `XJSStringLiteral` which would then consist of one or more `XJSText`/`XJSEntity`. This is perhaps the neater solution, but also more invasive (I don't mind though).

Feel free to agree, disagree, reject, etc.