-
-
Notifications
You must be signed in to change notification settings - Fork 943
ast: Incomplete HTML entity handling for JSXText and JSXAttributeValue #9667
Copy link
Copy link
Open
Labels
A-astArea - ASTArea - AST
Description
I found 2 mismatches in the AST of JSX generated by ESTree-compatible parsers such as Acorn(+acorn-jsx).
- (1) The
JSXTextnode does not have arawproperty - (2) Neither
JSXAttributeValuenorJSXTextprocesses HTML entities
For (1), the solution is simply to add the property. The value should be the same as that of a StringLiteral, using the Span position.
👉🏻 UPDATE: (1) is now fixed in #9641
For (2), the situation is a bit more complex, adjustments are needed for:
- The
valueofJSXAttributeValue::StringLiteral - The
valueofJSXText
In these cases, it is necessary to assign the value with HTML entities resolved.
Currently, OXC seems to handle this in a transformer following TypeScript?
However, to output an AST identical to Acorn(+arcorn-jsx), this needs to be performed during the parsing.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-astArea - ASTArea - AST
Type
Fields
Give feedbackPriority
None yet
