-
Notifications
You must be signed in to change notification settings - Fork 47.7k
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
Warn if rendering invalid element, fixes #3726 #8396
Warn if rendering invalid element, fixes #3726 #8396
Conversation
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 this is getting loaded on the server you can't use document.createElement
. Not sure that is the case though
* | ||
* https://www.w3.org/TR/custom-elements/#custom-elements-api | ||
*/ | ||
knownTag = !(document.createElement(instance._tag) instanceof UnknownConstructor); |
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.
does SSR still work with this enabled?
@@ -253,6 +254,8 @@ if (__DEV__) { | |||
} | |||
|
|||
validateDOMNesting(null, String(content), this, this._ancestorInfo); | |||
validateDOMTag(this, this._ancestorInfo); |
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.
I believe the changes in this file should be replicated in the Fiber component as well.
It would make sense to me to not warn on any tag that has a |
Fixed in #9163 |
This PR adds a warning whenever a user attempts to render an element unrecognized by the browser.
TODO
npm test
).validateDOMTag
much likevalidateDOMNesting
The tests for
ReactDOMComponent
include a lot of custom web components that will now show a warning because they haven't been defined before they were used. I'm not sure how to solve this issue yet. I'm hesitant to change the existing specs and, from an initial glance, it looks like jsdom doesn't fully support the web componentcustomElements
property yet. @spicyj Any ideas on how to go around resolving this?Here is a quick look at the warning:
