dotnet / aspnetcore

ASP.NET Core is a cross-platform .NET framework for building modern cloud-based web applications on Windows, Mac, or Linux.
https://asp.net
MIT License
35.19k stars 9.93k forks source link

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

Closed akorchev closed 4 years ago

akorchev commented 4 years ago

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

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 commented 4 years ago

@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.

https://github.com/dotnet/aspnetcore/issues/18271

akorchev commented 4 years ago

@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?