I want to use method getBBox() for getting width and height of element created in SVG
here I provide my code which gives result in chrome but not firefox
Please help me how to solve it..
try {
console.log(document.getElementById("rect1").getBBox());
console.log(document.getElementById("rect2").getBBox());
} catch (e) {
console.log(e);
}
svg {
border: 1px dashed blue;
}
#rect2 {
display: none;
}
<svg width="300" height="200" style="border:1px dashed blue">
<rect id="rect1" width="50" height="50" fill="steelblue"></rect>
<rect id="rect2" width="50" height="50" fill="blue" x="100"></rect>
</svg>