As stated in the spec in this thread , I think itβs
Note that getBBox must return the actual bounding box during the method call, even if the item has not yet been processed.
"Even if the item has not yet been processed," seems to be an anchor point to IE, this problem persists a year after IE11. The only other possibility that I can see from experience is that with g tags that do not have explicit widths and heights according to the IE specification, it is possible to just completely exclude this check, since in βhave no widthβ, apparently the same as 0 for IE codebase.
So, a workaround would be to look for the biggest child as you go. In your specific case, as a workaround, you can just grab lastChild when you add it to the g tag. Change the JS code in the script to this (I also fixed the svgns thing, as Thomas W mentioned in the comments).
var temp; temp = document.createElementNS("http://www.w3.org/2000/svg","text"); temp.appendChild(document.createTextNode("..")); temp.setAttribute("x",38); temp.setAttribute("y",18); document.getElementById("tata").appendChild(temp); alert(document.getElementById("tata").lastChild.getBBox().width);
As you can see, only the last line I changed moved to lastChild to getBBox() should warn 8 instead of 0 now like in Firefox and other browsers.
source share