facebook / jsx

The JSX specification is a XML-like syntax extension to ECMAScript.

Home Page:http://facebook.github.io/jsx/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Distinguish tags from elements in the terminology

tuukka opened this issue · comments

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

jsx/spec.emu

Lines 66 to 71 in d614ce7

JSXElement :
JSXSelfClosingElement
JSXOpeningElement JSXChildren? JSXClosingElement
JSXSelfClosingElement :
`<` JSXElementName JSXAttributes? `/` `>`

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? `/` `>`