ionic-team / ionic-team/ionicons

src tag for custom icons does not render for some svg group ids

Offen
#888 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
help wanted type: bug
Vorherrschende Sprache
TypeScript
Sterne
18.2k
Forks
2.1k
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

When adding a custom icon to ion-icon component using the src tag, some ids cause the svg to not be inserted into the DOM / rendered. For example, if you change the `g id="o"` to an id of "on" or "onon" or "one" or "OnePage" or "OnePage--my-id-1" or many other things, the icon doesn't get put inside the `icon-inner` div. Ids that I have found which do make the svg add into the ion-icon element: "a", "b", "bb", "bbb", "bbbb". "O". Removing the id from the group tag allows the icon to render into the DOM.

works:

```

```

doesn't work:

```

```

I can't think of any logical reason why changing this id arbitrarily makes this svg sometimes work and sometimes not? Also, the issue is only when the svg is used as an ionicon not when it is put inside of an ion-button directly, for example.

To reproduce, save the above xml as .svg file in the assets folder and link it with ionicons, eg: ``

EDIT: After searching through the code for ionicons, I found [this line](https://github.com/ionic-team/ionicons/blob/master/src/components/icon/validate.ts#L42). For some reason if the element value contains "on" in any case then it thinks the svg is invalid. What is the purpose behind this conditional? How could we fix it?

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.