Skip to content

[Blazor] Incorrect DOM namespace used with children of SVG foreignObject #19092

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

Closed
akorchev opened this issue Feb 17, 2020 · 2 comments
Closed
Labels
area-blazor Includes: Blazor, Razor Components

Comments

@akorchev
Copy link

Describe the bug

Blazor seems to always use the SVG namespace when updating DOM nodes that are children of a SVG element.

To Reproduce

Use this Blazor page

<svg width="100" height="100">
    <foreignObject x="0" y="0" width="100" height="100">
        <strong>foo</strong>
        <strong>@foo</strong>
    </foreignObject>
</svg>

@code {
    string foo = "foo";
}

When you render it the second <strong> disappears immediately.

blazor-foreignObject

The DOM node is still there though:

image

Further inspection reveals the cause of the problem. The namespace of the second <strong> node is SVG.
image

The first which works has XHTML as a namespace.

image

I think the first works because it is "static" content.

Further technical details

  • ASP.NET Core version - 3.1.101
  • Include the output of dotnet --info
.NET Core SDK (reflecting any global.json):
 Version:   3.1.101
 Commit:    b377529961

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  10.14
 OS Platform: Darwin
 RID:         osx.10.14-x64
 Base Path:   /usr/local/share/dotnet/sdk/3.1.101/

Host (useful for support):
  Version: 3.1.1
  Commit:  a1388f194c

.NET Core SDKs installed:
  2.1.2 [/usr/local/share/dotnet/sdk]
  2.1.302 [/usr/local/share/dotnet/sdk]
  2.1.400 [/usr/local/share/dotnet/sdk]
  2.1.403 [/usr/local/share/dotnet/sdk]
  2.1.500 [/usr/local/share/dotnet/sdk]
  2.2.105 [/usr/local/share/dotnet/sdk]
  3.1.101 [/usr/local/share/dotnet/sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.1.2 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.5 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.6 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.2.3 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.2 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.5 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.6 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.2.3 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.1 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.0.3 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.2 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.5 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.6 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.2.3 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.1 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  • The IDE (VS / VS Code/ VS4Mac) you're running on, and it's version - VS Code 1.42.1
@javiercn javiercn added the area-blazor Includes: Blazor, Razor Components label Feb 17, 2020
@javiercn
Copy link
Member

@akorchev thanks for contacting us.

We currently don't properly support SVG. We have a separate issue tracking this work, so I'm going to close this one in favor of the tracking issue we already have.

#18271

@akorchev
Copy link
Author

@javiercn Ouch. We've undertaken quite a big SVG related task (Radzen Blazor Chart). So far this is the only issue with SVG and Blazor. Do you know what the existing issues are?

@ghost ghost locked as resolved and limited conversation to collaborators Mar 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-blazor Includes: Blazor, Razor Components
Projects
None yet
Development

No branches or pull requests

2 participants