I have a number of inline SVGs in a website I maintain, and they\'re broken in Firefox. Each is broken when vector-effect: non-scaling-stroke is applied. They still render, but
Apparently this doesn't happen if you use a path instead of a circle. Also, as it is your code in this moment you have a repeating id
for the svg elements.
In the next example I'm using a function to create a circle as a path. If you don't want to use javascript you can get the d attribute for the path from the inspector. I hope it helps.
const SVG_NS = "http://www.w3.org/2000/svg";
function drawCircle(cx, cy, r, parent) {
let circle_path = document.createElementNS(SVG_NS, "path");
let d = `M${cx + r},${cy} A${r},${r} 0 0 0 ${cx -
r},${cy} A${r},${r} 0 0 0 ${cx + r},${cy}z`;
circle_path.setAttributeNS(null, "d", d);
parent.appendChild(circle_path);
return circle_path;
}
let circles = []
circles.push(drawCircle(149.5, 100.4, 27.1, circles1));
circles.push(drawCircle(69.9, 60.1, 40.8, circles1));
circles.push(drawCircle(149.5, 100.4, 27.1, circles2));
circles.push(drawCircle(69.9, 60.1, 40.8, circles2));
circles.map(c=>{
c.setAttribute("class", "stroke-blue stroke-2 no-fill stroke-rounded grey-stroke-hover non-scaling-stroke")
})
/* Start the magic css for locking down svg stroke width */
.non-scaling-stroke {
vector-effect: non-scaling-stroke;
}
/* End magic */
.blue-fill {
fill: #009bdf;
}
.stroke-2 {
stroke-width: 2;
stroke-miterlimit: 0;
}
.stroke-blue {
stroke: #009bdf;
}
.no-fill {
fill: none;
}
.stroke-rounded {
stroke-linecap: round;
stroke-linejoin: round;
}