Skip to content
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

Improve validateDOMNesting message for whitespace #7515

Merged
merged 1 commit into from
Aug 19, 2016

Conversation

sophiebits
Copy link
Collaborator

For #5071.

} else {
tagDisplayName = 'Whitespace text nodes';
whitespaceInfo =
' Make sure you don\'t have any extra whitespace between tags on ' +
Copy link
Contributor

@mnpenner mnpenner Aug 18, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this message be confusing? Whitespace doesn't matter between JSX tags -- doesn't this problem only occur when there's whitespace inside a variable?

Edit: Nevermind, per this blog post, whitespace can appear when:

Element nodes will maintain white space when mixed with with non-element nodes on the same physical line of JSX code.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whitespace between tags on a single line matters, and I believe that's the most common cause of extra whitespace. See "Foo" in the test case below.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aha, didn't know that. I guess that makes sense, but it's not something you normally think about! (Which is why this warning is helpful!)

@gaearon
Copy link
Collaborator

gaearon commented Aug 19, 2016

👍

@ghost ghost added the CLA Signed label Aug 19, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants