-
Notifications
You must be signed in to change notification settings - Fork 178
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
href channel #645
href channel #645
Conversation
src/style.js
Outdated
const a = document.createElementNS(namespaces.svg, "a"); | ||
a.setAttributeNS(namespaces.xlink, "href", href[i]); | ||
if (target != null) a.setAttribute("target", target); | ||
this.parentNode.insertBefore(a, this).appendChild(this); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
makes we wish we could do selection.wrap("svg:a") (related: d3/d3-selection#296)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
selection.wrap: d3/d3-selection#297
wonder if we shouldn't have target: "_blank" by default? |
I don’t think so, no. I do wonder whether it’s possible to set the equivalent of a |
Any other changes, @Fil? Or LGTY? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's good, we'll just have to add tests
* cheeky test plot for href * tweak test; add snapshot Co-authored-by: Mike Bostock <[email protected]>
Adds a generic href channel that wraps the specified mark elements with an A element with the appropriate xlink:href attribute. A target option is also available (e.g., “_blank”). I didn’t implement it for grouped marks (lines and areas), but maybe I should. Fixes #283.