Skip to content

[automated] Merge branch 'release/7.0' => 'main' #44183

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

Merged
2 commits merged into from
Sep 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Components/Web.JS/dist/Release/blazor.server.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/Components/Web.JS/dist/Release/blazor.webview.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/Components/Web.JS/src/Rendering/BrowserRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ export class BrowserRenderer {
// disposed event handler IDs are delivered separately (in the 'disposedEventHandlerIds' array)
const siblingIndex = editReader.siblingIndex(edit);
const element = getLogicalChild(parent, childIndexAtCurrentDepth + siblingIndex);
if (element instanceof HTMLElement) {
if (element instanceof Element) {
const attributeName = editReader.removedAttributeName(edit)!;
// First try to remove any special property we use for this attribute
if (!this.tryApplySpecialProperty(batch, element, attributeName, null)) {
Expand Down
16 changes: 16 additions & 0 deletions src/Components/test/E2ETest/Tests/SvgTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,22 @@ public void CanRenderSvgWithCorrectNamespace()
Browser.Equal("20", () => svgCircleElement.GetAttribute("r"));
}

[Fact]
public void CanRenderSvgWithAttributeRemoval()
{
var appElement = Browser.MountTestComponent<SvgComponent>();

var svgElement = appElement.FindElement(By.Id("svg-with-callback"));
Assert.NotNull(svgElement);

var svgCircleElement = svgElement.FindElement(By.XPath("//*[local-name()='circle' and namespace-uri()='http://www.w3.org/2000/svg']"));
Assert.NotNull(svgCircleElement);
Assert.Equal("stroke: red;", svgCircleElement.GetAttribute("style"));

appElement.FindElement(By.TagName("button")).Click();
Browser.Equal("", () => svgCircleElement.GetAttribute("style"));
}

[Fact]
public void CanRenderSvgChildComponentWithCorrectNamespace()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

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

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

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

@code {
int radius = 10;
string styleValue = "stroke: red;";
string bar = "thestringbar";

int value = 10;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@
<!--#if PWA -->
<link href="manifest.json" rel="manifest" />
<!--#endif -->

<!--#if Hosted -->
<!-- If you add any scoped CSS files, uncomment the following to load them
<link href="EmptyComponentsWebAssembly_CSharp.Client.styles.css" rel="stylesheet" /> -->
<!--#else -->
<!-- If you add any scoped CSS files, uncomment the following to load them
<link href="EmptyComponentsWebAssembly_CSharp.styles.css" rel="stylesheet" /> -->
<!--#endif -->
</head>

<body>
Expand Down