|
|
|
|
|
by cphoover
1683 days ago
|
|
I agree 100%... Adding JSX to the language spec would be interesting. It might be too heavy to include within the language spec as many JS applications do not involve the DOM at all, so then you have to essentially bundle DOM functions into every application... or common.js would omit this subset of the language. |
|
https://github.com/facebook/jsx
Example parser from Acorn:
https://github.com/acornjs/acorn-jsx/blob/master/index.js
No part of JSX uses the DOM, it doesn't share anything with HTML.
The JS engine itself would need the modification.
Also JSX doesn't have to be for the UI, it could be for dialogs for an NPC in a game, for configs, etc.
edit: I agree with @proxyon, I'm really disappointed with HN that this simple fact is downvoted without retort.
The common sentiment here is wrong, JSX is a small extension to the grammar of JS. It is JS.