Support for xlink:href
See original GitHub issueHey guys,
SVG support is currently incomplete, use
does not work because xlink:href
is a namespaced attribute that needs the couple setAttributeNS
/removeAttributeNS
.
I’m not opening a PR directly for this, but it’s a rather common use case and I think we should support it.
Some references:
- preact issue on the subject: https://github.com/developit/preact-svg/issues/15
- preact-way: https://github.com/developit/preact/blob/33fc697ac11762a1cb6e71e9847670d047af7ce5/src/dom/index.js#L81
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:7 (5 by maintainers)
Top Results From Across the Web
xlink:href - SVG: Scalable Vector Graphics - MDN Web Docs
The xlink:href attribute defines a reference to a resource as a reference IRI. The exact meaning of that link depends on the context...
Read more >SVG element: a: `xlink:href` | Can I use... Support ... - CanIUse
"Can I use" provides up-to-date browser support tables for support of front-end web technologies on desktop and mobile web ... SVG element: a:...
Read more >Support for xlink-href · Issue #139 · jorgebucaran/superfine
Well, Preact doesn't bother supporting xlink:href at all. But Inferno and React do. SVG 2 is only supported by Chrome and Firefox.
Read more >On xlink:href being deprecated in SVG - CSS-Tricks
So xlink:href will likely stay “deprecated” forever (not the recommended solution, but browsers must maintain support), never shifting over to “ ...
Read more >How to use xlinkHref on svg tag <a> using Typescript and React
You're trying to set xlinkHref on an a tag, which is not supported. The xlinkHref property should be used on a <use> tag...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
i’m 👍 on this from a practical standpoint. my current concern with adding it to domvm is the perf overhead of testing each attr name for namespace presence in a hot function. since it cannot be cheaply prefix-tested, running a regex of indexOf on every attr would greatly impact perf. there are some options tho.
:xlink:href
but is surprisingxlink:href
, which is cheap.for what it’s worth, i plan to add support for this in domvm, but have to figure out which mix of the above ideas would result in least perf degredation. i think custom prefixing is DOA due to non-uniformity 😦
@leeoniya @lukejacksonn Thanks for the feedback, let’s continue on this thread where we are discussing an alternative solution for things like this: #211.