Skip to content

JSX Lexical Analysis Issues #362

@citrizon

Description

@citrizon

Builtin JSX (Javascript XML) support in Meriyah is great but there is no proper lexical analysis going on. For example, meriyah thinks this is a valid JSX:

<hey=""></hey>

and the output is

{
  "type": "Program",
  "sourceType": "script",
  "body": [
    {
      "type": "ExpressionStatement",
      "expression": {
        "type": "JSXElement",
        "children": [],
        "openingElement": {
          "type": "JSXOpeningElement",
          "name": {
            "type": "JSXIdentifier",
            "name": "hey"
          },
          "attributes": [
            {
              "type": "JSXAttribute",
              "value": null,
              "name": {
                "type": "JSXIdentifier",
                "name": "hey"
              }
            },
            {
              "type": "JSXAttribute",
              "value": null,
              "name": {
                "type": "JSXIdentifier",
                "name": ""
              }
            }
          ],
          "selfClosing": false
        },
        "closingElement": {
          "type": "JSXClosingElement",
          "name": {
            "type": "JSXIdentifier",
            "name": "hey"
          }
        }
      }
    }
  ]
}

These ones also work even though they shouldn't:

<div=1></div>
<div=test></div>
<div=div></div>
<div=/>
<div=-/>
<div=+-%&([)]}.../>

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions