Getting ‘xlink:href’ attribute of the SVG element dynamically using JS in HTML DOM
The correct usage is getAttributeNS(‘http://www.w3.org/1999/xlink’, ‘href’);
The correct usage is getAttributeNS(‘http://www.w3.org/1999/xlink’, ‘href’);
Query selector can handle namespaces, but it gets tricky because The syntax for specifying namespaces in CSS selectors is different from html; The querySelector API doesn’t have any method for assigning a namespace prefix (like xlink) to an actual namespace (like “http://www.w3.org/1999/xlink”). On the first point, the relevant part of the CSS specs allows you … Read more