question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support for xlink:href

See original GitHub issue

Hey 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:

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:2
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
leeoniyacommented, May 20, 2017

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.

  • in domvm svg elems use their own factory, so perhaps plain vnodes can be saved from the overhead.
  • a non-standard extra prefix would be cheap to test more generally: :xlink:href but is surprising
  • rather than supporting any namespaced, just explicitly test for xlink: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 😦

0reactions
ngrymancommented, May 21, 2017

@leeoniya @lukejacksonn Thanks for the feedback, let’s continue on this thread where we are discussing an alternative solution for things like this: #211.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found