fix(svg): render red stroke in <use> example#44696
Open
kirthi-b wants to merge 2 commits into
Open
Conversation
The <use> example claimed to draw a circle with a different stroke color, but the referenced circle already set stroke="blue", so the stroke="red" on the last copy was ignored and rendered blue. Remove the stroke from the referenced circle so the red stroke renders as the text describes. The attribute-override behavior is still covered in the Usage notes section. Fixes mdn#44640
Contributor
|
Preview URLs (1 page) |
chrisdavidmills
requested changes
Jul 13, 2026
chrisdavidmills
left a comment
Contributor
There was a problem hiding this comment.
Hi @kirthi-b, and thank you for fixing this issue. I think your changes look fine — the example is now easier to understand, and the issue is fixed. I just had one comment for you to consider regarding improving the grammar in the example description.
| @@ -43,7 +43,6 @@ This element implements the {{domxref("SVGUseElement")}} interface. | |||
| ## Example | |||
|
|
|||
| The following example shows how to use the `<use>` element to draw a circle with a different fill and stroke color. | |||
Contributor
There was a problem hiding this comment.
Suggested change
| The following example shows how to use the `<use>` element to draw a circle with a different fill and stroke color. | |
| The following example shows how to use the `<use>` element to draw multiple circles with different fill and stroke colors. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #44640
The Example section on the
<use>page says it draws "a circle with a different fill and stroke color," and the last copy setsstroke="red". But the referenced#myCirclealready setstroke="blue", and a<use>copy cannot override a presentation attribute that the referenced element already defines, so the red was ignored and the circle rendered blue.Change
Remove
stroke="blue"from the referenced circle so thestroke="red"on the last copy renders, matching what the surrounding text describes. The attribute-override behavior is still explained in the Usage notes section, so nothing is lost.