-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Inline SVGs are not rendered #16341
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
Comments
Thanks for bringing this to our attention! |
I have the same issue. I think it's because the attributes are not computed. |
I have encountered the same issue and a quick play with the JS via Chrome dev tools suggests that the small below modification in insertElement(componentId: number, parent: Element, childIndex: number, frames: System_Array<RenderTreeFramePointer>, frame: RenderTreeFramePointer, frameIndex: number) {
const tagName = renderTreeFrame.elementName(frame)!;
const newDomElement = tagName === 'svg' || parent.namespaceURI === 'http://www.w3.org/2000/svg' ?
document.createElementNS('http://www.w3.org/2000/svg', tagName) :
document.createElement(tagName);
insertNodeIntoDOM(newDomElement, parent, childIndex);
... |
Additionally, SVG based components do not render due to the const containerElement = parent.namespaceURI === 'http://www.w3.org/2000/svg' ?
document.createElementNS('http://www.w3.org/2000/svg', 'g') :
document.createElement('blazor-component'); The comments suggest that the |
@sjroe Yes I also saw that the |
* Added SVG support (#366) * Added E2E tests for SVG
Resolved in dotnet/blazor#435 |
* Added SVG support (#366) * Added E2E tests for SVG
Inline SVGs are rendered to into the DOM but are not visually rendered by the browser.
It appears this issue is due to the way how the DOM is updated in
BrowserRenderer.ts
.I did some research and it appears this is the reason https://stackoverflow.com/questions/41161094/dynamically-created-svg-elements-are-not-rendered-by-the-browser
Minimal repro steps
Expected result
The browser treats this as normal html with inline svg and renders it properly
Actual result
The browser displays
Sorry, your browser does not support inline SVG.
due to the way how the DOM is updatedThe text was updated successfully, but these errors were encountered: