SVG Namespace prefix xlink for href on image is not defined

The <svg> element is missing the declaration of the xlink namespace, although it is used in the <image> elements. So just added like the following: <svg height=”1000″ preserveaspectratio=”xMidYMid meet” style=”width: 100%; height: 100%; transform: translate3d(0px, 0px, 0px);” viewbox=”0 0 1000 1000″ width=”1000″ xmlns=”http://www.w3.org/2000/svg” xmlns:xlink=”http://www.w3.org/1999/xlink”> SVG2 deprecated the xlink namespace for href attributes.. So in the … Read more

Is it possible to use HTML’s .querySelector() to select by xlink attribute in an SVG?

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