-
Notifications
You must be signed in to change notification settings - Fork 48.5k
Validate node nesting structure #735
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
Fixes facebook#767. This essentially reverts 738de8c. We could store some sort of flag to silence the console error here but since we've made significant improvements in markup wrapping, this error is fairly rare now. We'll also have validation of node structure soon in facebook#735.
@sebmarkbage Just updated with a pretty complete validateNodeNesting function. |
Got notified by Someone else came across it (and I think this PR is the fix?). |
Yeah, this will warn when putting a |
@@ -168,7 +183,7 @@ ReactDOMComponent.Mixin = { | |||
* | |||
* @private | |||
* @param {ReactReconcileTransaction} transaction | |||
* @return {string} Content markup. | |||
* @return {string|array<string>} Content markup or list of content markup. |
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.
This is always an array, right? You can just use .forEach and .join. No need for the added dependencies and extra helper module
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.
In the case of dangerouslySetInnerHTML
it's a string. I can get rid of that and make it an array always if you prefer.
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.
(@sebmarkbage Just checking in on this.)
👍 Just ran into this while playing around with React myself. Pretty sure our production code got this problem as well ;) |
This is a better version of facebook#644. Fixes facebook#101.
After talking with @sebmarkbage, I'm going to close this out since I think we don't want to do this this way. There's work being done to make this possible without inspecting markup. |
I just wanted to throw in my two cents that I came across this issue today as a react n00b and would've been completely lost without this post from @spicyj I found on the google group. I'm not sure how high of a priority this kind of a warning is but it is helpful to people who are new to the project. |
@mikemorton If #1550 is agreed upon then it should provide us with the ability to cheaply warn/throw when the browser mucks with the DOM. |
Nicer version of facebook#644 and facebook#735. Fixes facebook#101. Context is neat.
This is a better version of #644. Fixes #101.