caniuse icon indicating copy to clipboard operation
caniuse copied to clipboard

Add SVG `use` with external reference

Open alejandroiglesias opened this issue 7 years ago • 8 comments

It would be good to add this feature since the browser support is variable (no IE or old Safari). How it looks like:

<!-- Reference IN THIS SAME DOCUMENT -->
<svg>
  <use xlink:href="#icon-1"></use>
</svg>

<!-- EXTERNAL reference -->
<svg>
  <use xlink:href="sprite.svg#icon-1"></use>
</svg>

More info:

  • https://css-tricks.com/svg-use-with-external-reference-take-2/
  • https://wpdev.uservoice.com/forums/257854-microsoft-edge-developer/suggestions/6263916-svg-external-content?tracking_code=85a4cffafffac0497bb5074ed03d43f5

alejandroiglesias avatar Jun 28 '17 13:06 alejandroiglesias

+1

Edge 12 also doesn't support this, according to the svg4everybody polyfill

Ugoku avatar Jun 30 '17 08:06 Ugoku

Also xlink deprecation: https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/xlink:href.

kfbow avatar Nov 18 '17 01:11 kfbow

+1

Herst avatar Nov 18 '17 09:11 Herst

+1. I just tried to look this up because of the xlink:href deprecation :)

mehulkar avatar Mar 09 '18 19:03 mehulkar

Looks like this is now covered by MDN data: https://caniuse.com/mdn-svg_elements_use_xlink_href https://caniuse.com/mdn-svg_elements_use_href

(via mdn/browser-compat-data#1419)

GPHemsley avatar Jan 03 '22 22:01 GPHemsley

I think the MDN data is just for support xlink:href, not specific to external references

Fyrd avatar Jan 08 '22 22:01 Fyrd

I think the MDN data is just for support xlink:href, not specific to external references

I thought <use xlink:href> and <use href> was all this issue was about. I'm not seeing any examples of other forms of external references.

GPHemsley avatar Jan 16 '22 16:01 GPHemsley

MDN’s content for SVG is woefully incomplete. Don’t expect it to be as comprehensive or up-to-date for SVG as it is for HTML, CSS, and JS.

Zearin avatar Aug 21 '22 16:08 Zearin