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

Problem with svg with name 'us' or 'pe' or 'se' #65

Open
PhilFlash opened this issue Nov 28, 2023 · 2 comments
Open

Problem with svg with name 'us' or 'pe' or 'se' #65

PhilFlash opened this issue Nov 28, 2023 · 2 comments

Comments

@PhilFlash
Copy link

Hi

If I use name 'us', 'pe' or 'se', fast svg display suspenseSvg.

In my case, I use fast-svg for flag for country with https://github.com/lipis/flag-icons
The name of flag is based on iso code with two letters.

Example here:
https://stackblitz.com/~/github.com/PhilFlash/fast-svg-bug
It's a standalone application generated by Angular CLI.
I use a flag fr (for french).
The us.svg pe.svg and se.svg is a simple copy of fr.svg (so no problem with the svg code).
<fast-svg name="us" ...> and <fast-svg name="pe" ...> and <fast-svg name="se"...> display suspenseSvg.

Philippe

@PhilFlash
Copy link
Author

The bug is in file src/lib/fast-svg.component.ts line 185.
if (cache.name.includes(this.name)) {

For first time, cache name is : #suspense
If name is 'us', the condition is true => #suspense.include('us')
If name is 'pe', the condition is true => #suspense.include('pe')
If name is 'se', the condition is true => #suspense.include('se')

In these cases, img.removeEventListener('load', this.loadedListener); and the svg is not loaded.

But, I have not found a fix for this problem

Philippe

@PhilFlash
Copy link
Author

I propose to replace in file src/lib/fast-svg.component.ts line 185
if (cache.name.includes(this.name)) {
by
if (cache.name === ('#'+this.name)) {

@PhilFlash PhilFlash mentioned this issue Jan 11, 2024
1 task
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