facebook / jsx

The JSX specification is a XML-like syntax extension to ECMAScript.
http://facebook.github.io/jsx/
1.96k stars 133 forks source link

Is JSXNamespacedName needed? #13

Closed RReverser closed 9 years ago

RReverser commented 9 years ago

Maybe it's just me, but it doesn't look clear why do we have JSXNamespacedName in spec, if, as far as I remember, after long discussions JSXMemberExpression was introduced exactly as replacement for first one (it's not supported by E4X but looks more familiar as for JS).

Or was it just for React (which emits error on trying to use namespaced name) and :-based namespaces were preserved for DOM-based JSX implementations?

It's somewhat confusing, so if there's reason for both to exist, maybe it makes sense to add a description cases in which one or another namespace syntax should be used. If there's no such reason, then maybe it makes sense to remove it from spec as deprecated so new tools wouldn't have to handle it.

syranide commented 9 years ago

I think it just exists because XML supports it and this allows us to throw a more helpful error. JSX does not allow it to be used anywhere AFAIK. It's possible it will be necessary in the future (SVG... I'm look at you), but I'm not really sure.

RReverser commented 9 years ago

@syranide That's why I propose to just drop it from spec so other implementors don't need to care specifically of this case and can just emit generic "unexpected character" error. If it will be needed in future, we can add it easily.

sebmarkbage commented 9 years ago

React's JSX doesn't support it but other use cases does. For example, we actually use it for our internationalization library. That is a different transform of the same syntax. This spec is for the generic syntax alone. React's transform has chosen to not include all of it. There's a note in the spec that any transform can chose to support a subset.