Skip to content

Commit 41bed3f

Browse files
author
msftbot[bot]
authored
Merge pull request dotnet#44183 from dotnet-maestro-bot/merge/release/7.0-to-main
[automated] Merge branch 'release/7.0' => 'main'
2 parents 600e806 + 3b036f9 commit 41bed3f

File tree

6 files changed

+30
-5
lines changed

6 files changed

+30
-5
lines changed

src/Components/Web.JS/dist/Release/blazor.server.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Components/Web.JS/dist/Release/blazor.webview.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Components/Web.JS/src/Rendering/BrowserRenderer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ export class BrowserRenderer {
136136
// disposed event handler IDs are delivered separately (in the 'disposedEventHandlerIds' array)
137137
const siblingIndex = editReader.siblingIndex(edit);
138138
const element = getLogicalChild(parent, childIndexAtCurrentDepth + siblingIndex);
139-
if (element instanceof HTMLElement) {
139+
if (element instanceof Element) {
140140
const attributeName = editReader.removedAttributeName(edit)!;
141141
// First try to remove any special property we use for this attribute
142142
if (!this.tryApplySpecialProperty(batch, element, attributeName, null)) {

src/Components/test/E2ETest/Tests/SvgTest.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,22 @@ public void CanRenderSvgWithCorrectNamespace()
4242
Browser.Equal("20", () => svgCircleElement.GetAttribute("r"));
4343
}
4444

45+
[Fact]
46+
public void CanRenderSvgWithAttributeRemoval()
47+
{
48+
var appElement = Browser.MountTestComponent<SvgComponent>();
49+
50+
var svgElement = appElement.FindElement(By.Id("svg-with-callback"));
51+
Assert.NotNull(svgElement);
52+
53+
var svgCircleElement = svgElement.FindElement(By.XPath("//*[local-name()='circle' and namespace-uri()='http://www.w3.org/2000/svg']"));
54+
Assert.NotNull(svgCircleElement);
55+
Assert.Equal("stroke: red;", svgCircleElement.GetAttribute("style"));
56+
57+
appElement.FindElement(By.TagName("button")).Click();
58+
Browser.Equal("", () => svgCircleElement.GetAttribute("style"));
59+
}
60+
4561
[Fact]
4662
public void CanRenderSvgChildComponentWithCorrectNamespace()
4763
{

src/Components/test/testassets/BasicTestApp/SvgComponent.razor

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44

55
<h3>SVG with Callback</h3>
66
<svg height="250" width="250" id="svg-with-callback">
7-
<circle cx="125" cy="125" r=@radius fill="red" stroke="black" stroke-width="3" />
7+
<circle cx="125" cy="125" r=@radius fill="red" stroke="black" stroke-width="3" style="@styleValue" />
88
</svg>
99

10-
<button @onclick=@(() => { radius *= 2; })>Click me</button>
10+
<button @onclick=@(() => { radius *= 2; styleValue = null; })>Click me</button>
1111

1212
<h3>SVG with Child Component</h3>
1313
<svg height="250" width="250" id="svg-with-child-component">
@@ -81,6 +81,7 @@
8181

8282
@code {
8383
int radius = 10;
84+
string styleValue = "stroke: red;";
8485
string bar = "thestringbar";
8586

8687
int value = 10;

src/ProjectTemplates/Web.ProjectTemplates/content/EmptyComponentsWebAssembly-CSharp/Client/wwwroot/index.html

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@
88
<!--#if PWA -->
99
<link href="manifest.json" rel="manifest" />
1010
<!--#endif -->
11+
12+
<!--#if Hosted -->
13+
<!-- If you add any scoped CSS files, uncomment the following to load them
14+
<link href="EmptyComponentsWebAssembly_CSharp.Client.styles.css" rel="stylesheet" /> -->
15+
<!--#else -->
16+
<!-- If you add any scoped CSS files, uncomment the following to load them
17+
<link href="EmptyComponentsWebAssembly_CSharp.styles.css" rel="stylesheet" /> -->
18+
<!--#endif -->
1119
</head>
1220

1321
<body>

0 commit comments

Comments
 (0)