Given:
<body>
<svg xmlns=http://www.w3.org/2000/svg xmlns:xlink=http://www.w3.org/1999/xlink>
<a xlink:href=url></a>
</svg>
</body>
Is it possible to use the HTML DOM's .querySelector()
or .querySelectorAll()
to select the link inside the SVG by the contents of its xlink:href
attribute?
This works:
document.querySelector('a') // <a xlink:href=url/>
These don't:
document.querySelector('[href=url]') // null
document.querySelector('[xlink:href=url]') // Error: not a valid selector
document.querySelector('[xlink:href=url]') // Error: not a valid selector
document.querySelector('[xlink\:href=url]') // null
Is there a way of writing that attribute selector to make it 'see' the xlink:href
?