astro-icon icon indicating copy to clipboard operation
astro-icon copied to clipboard

The deprecated `xlink:href` attribute should be replaced with `href`

Open yudai-nkt opened this issue 1 year ago • 1 comments

What version of astro-icon are you using?

v1.1.0

Astro Info

Astro                    v4.4.4
Node                     v18.18.0
System                   macOS (x64)
Package Manager          npm
Output                   static
Adapter                  none
Integrations             astro-expressive-code
                         astro-icon
                         @astrojs/sitemap

If this issue only occurs in one browser, which browser is a problem?

N/A

Describe the Bug

Astro Icon uses the deprecated xlink:href attribute and it gives me linting errors.

https://github.com/natemoo-re/astro-icon/blob/a4ff8736965214e16ce0b72364f43b3a4973f281/packages/core/components/Icon.astro#L123-L126

Below is an excerpt from the relevant part of SVG spec:

In previous versions of SVG, the ‘href’ attribute was specified in the XLink namespace [xlink] namespace. This usage is now deprecated and instead URL references should be specified using the ‘href’ attribute without a namespace.

What's the expected result?

The href attribute should be used instead.

I can submit a PR, but would you think this is a breaking change although icon visuals remain the same? If you do, I'd like to discuss how we keep compatibility before working on the fix.

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-vgk3vl?file=src%2Fpages%2Findex.astro

yudai-nkt avatar Feb 25 '24 05:02 yudai-nkt

We just ran into this issue too and for some reason we have a scenario where the xlink:href does not work, replacing it with href makes the icon show up.

toxsick avatar Sep 20 '24 12:09 toxsick

Thank you for filing the issue. I have created a PR with the fix.

stramel avatar Oct 22 '24 06:10 stramel