Closed
Description
This line of code:
... is wrong. It should work for SVGElement
and HTMLElement
, so at first glance at least, we should change it to if (element instanceof Element) {
.
Repro
Click the rectangle:
<svg xmlns="http://www.w3.org/2000/svg" viewbox="0 0 100 100" width="100" height="100" @onclick="@(() => styleValue = null)">
<rect x="0" y="0" width="100" height="100" style="@styleValue"></rect>
</svg>
@code {
string? styleValue = "stroke: red";
}
The error is:
crit: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]
Unhandled exception rendering component: Cannot remove attribute from non-element child
Error: Cannot remove attribute from non-element child
at se.applyEdits (https://localhost:7142/_framework/blazor.webassembly.js:1:21866)
Originally reported as #43858