Skip to content

Instantly share code, notes, and snippets.

@carlosperez
Created October 3, 2014 15:45
Show Gist options
  • Save carlosperez/99304b4a5f2fc647a51f to your computer and use it in GitHub Desktop.
Save carlosperez/99304b4a5f2fc647a51f to your computer and use it in GitHub Desktop.
Force d3 to output the xlink namespace on anchor tags
vis.select('#points')
.selectAll('.point')
.enter()
.append('svg:a')
.attr('xlink:xlink:href', '#') // add the namespace TWICE
.append('svg:circle')
// and so on and so forth
@carlosperez
Copy link
Author

We wracked our brains too much on this one... D3 seemed to be removing the xlink namespace from our SVG anchor tags. As a result, the links wouldn't work. At first we assumed Chrome was removing the namespace, but realized it wasn't even present in the source (not just not showing in the Web Inspector).

So yah. It's 2014 and we are super happy that we got links to work on a web site.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment