facebook / jsx

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

Distinguish tags from elements in the terminology #151

Open tuukka opened 2 years ago

tuukka commented 2 years ago

Has it been a deliberate choice to treat the terms tag and element as synonyms in the spec and the grammar?

https://github.com/facebook/jsx/blob/d614ce76e6ea996ea6dfa122f2a7be71ed96e6eb/spec.emu#L66-L71

I find this lack of distinction confusing when teaching JSX.

I think the following would be more clear and in line with the terminology used for HTML (e.g. Document.getElementsByTagName vs Document.getElementsByName):

      JSXElement :
        JSXSelfClosingTag
        JSXOpeningTag JSXChildren? JSXClosingTag

      JSXSelfClosingTag :
          `<` JSXTagName JSXAttributes? `/` `>`