4 ms·
Facebook has been doing a lot of work in this area, initially implemented in PHP by Marcel Laverdet in 2010, called XHP[1]. Not only does it permit you to embed
by jonchang 12y ago
Facebook has been doing a lot of work in this area, initially implemented in PHP by Marcel Laverdet in 2010, called XHP[1]. Not only does it permit you to embed conformant HTML into your PHP code without inadvertently introducing XSS vectors, but it also allows you to compose HTML primitives into high-level markup. Stefan Parker has been regularly blogging since 2011 about how Facebook uses XHP in its UI design; one of the best posts on the topic is here[2]. You may also recall the now-defunct "Facebook Lite" which was written completely in XHP.
Laverdet also implemented something similar for node.js called js-xml-literals[3], which I don't think has gained much traction. As for how it's different from E4X, refer to this page[4], which makes the argument that parsing and producing XML are two different tasks; E4X attempts to do both while all of these other approaches focus on producing XML.
(I don't think that this perspective on the history of react.js/jsx has been well-publicized before, hence the post.)
[1]: https://www.facebook.com/notes/facebook-engineering/xhp-a-new-way-to-write-php/294003943919 https://www.facebook.com/notes/facebook-engineering/xhp-a-ne...
[2]: http://codebeforethehorse.tumblr.com/post/52824249342/building-a-good-ui-framework-with-xhp http://codebeforethehorse.tumblr.com/post/52824249342/buildi...
[3]: https://github.com/laverdet/js-xml-literal https://github.com/laverdet/js-xml-literal
[4]: https://github.com/laverdet/js-xml-literal/wiki/Differences-from-E4X https://github.com/laverdet/js-xml-literal/wiki/Differences-...
- kiyoto 12y agoMy only quip about this JSX is nomenclature: Oku et. al. at DeNA open-sourced a typed variant of ECMAScript under the exact same name a couple of years earlier: http://jsx.github.io/ http://jsx.github.io/ With Facebook's brand and recognition, I am sure this JSX will eclipse the other JSX, which is rather unfortunate.