-
Notifications
You must be signed in to change notification settings - Fork 12.9k
For JSX text, construct a single literal node "foo bar"
instead of "foo" + " " + "bar"
#10782
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…`"foo" + " " + "bar"`.
Is there an issue tracking this? |
This is not a bug. The output was just unnecessarily complicated. |
FWIW Babel used to emit the |
@Andy-MS there are some failing tests in this PR. |
// when it emits the literal. We do, however, need to decode JSX entities. | ||
parts.push(createLiteral(decodeEntities(part))); | ||
const part = decodeEntities(text.substr(firstNonWhitespace, lastNonWhitespace - firstNonWhitespace + 1)); | ||
acc = acc === undefined ? part : acc + " " + part; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you write
<div>
hello\
world
</div>
What is the output?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will be properly escaped: "hello\\ world"
.
CI's failing again |
No description provided.