Skip to content
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

An issue with applying a linearGradient on SVG element. #88

Open
dominikkrulak opened this issue Oct 2, 2024 · 0 comments
Open

An issue with applying a linearGradient on SVG element. #88

dominikkrulak opened this issue Oct 2, 2024 · 0 comments

Comments

@dominikkrulak
Copy link

I have this simple SVG element with a gradient.

<svg viewBox="0 0 10 10">
	<defs>
		<linearGradient id="myGradient" gradientTransform="rotate(90)">
			<stop offset="5%" stop-color="gold" />
			<stop offset="95%" stop-color="red" />
		</linearGradient>
	</defs>
	<circle cx="5" cy="5" r="4" fill="url('#myGradient')" />
</svg>

When rendered, the svg element itself gets rendered but the gradient isn't applied.

Gradient isn't applied example

Screenshot 2024-10-02 at 20 41 17

When I edit the element straight from browser, the gradient is applied after render engine updates DOM.

Gradient is applied after changes made to the element using inspection tool example

Screenshot 2024-10-02 at 20 46 45

When I checked the compiled template

 // ...
  attr: {
	"cx": "5",
	"cy": "5",
	"r": "4",
	"fill": "url('#myGradient')"
 },
// ...

the fill key has #myGradient in quotes. Could this be a problem, maybe?

I created the SVG using vanilla JS and tested it with and without the quotes and it worked in my environment.

Any thought?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant