-
Notifications
You must be signed in to change notification settings - Fork 46.9k
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
Server Rendering SVG foreignObject body tag w 15rc2 results in missing ID error #6280
Comments
We never render the |
Thanks for tracking down more specifically. Could be that browsers don't actually support that body usage? Or when actually parsed from markup, the body node doesn't exist (which seems likely and matches up with what we see in other situations where the browser changes markup). I won't have a chance to look into this more for a few days - it might be best to just use your alternate approach for now. |
I can remove the body tag. It seems to work ok with out it. Whats clear at this point is that if the server sends the body tag, it is not parsed into a DOM node, at least on mac with Chrome and Safari. That results in the error, since the data-reactid for the body is missing. IE doesn't support foreignObject so its not relevant there. MS Edge does, but I haven't tested it. |
It seems so. Even without React, I can’t get Chrome (or Firefox for that matter) to make |
@gaearon FWIW, |
Sounds like we should add this to Not sure which HTML tags are and aren't allowed but it might be detailed in the HTML5 spec at https://html.spec.whatwg.org/multipage/. |
Can I take this one? @toddgeist |
@keyanzhang please do :-) |
(I am using 15rc2 because I need all the svg tags)
I am rendering a foreignObject svg tag. According to MDN I put body tag inside that tag and then whatever html I want in there.
renderToString on the server leaves the body tag in place, and gives it a react-dataid. However when rendered on the client that body tag is removed. So when I look at the live elements, the body inside foreignObjects is gone, along with it's data-reactid. The server source ( ie view page source ) shows that the body tag was rendered with the missing react-dataid.
The result is that you get a “Invariant Violation: Unable to find element with ID XX”, when the page updates, and somethings don't work.
Removing the body from inside the foreignObject tag seems to solve the problem,
but I don't know if that is an "OK" solution to this or if that body tag is necessary in some scenarios. But in either case this seems to be a scenario where server rendering results in different DOM/HTML then client rendering.
Is this a problem, or is the body tag not supposed to there anyway?
Todd
The text was updated successfully, but these errors were encountered: