- From: Karl Dubost via GitHub <noreply@w3.org>
- Date: Thu, 30 Oct 2025 05:06:50 +0000
- To: public-svg-issues@w3.org
The resolution that I was about to write down today as a PR is > RESOLUTION: let's remove the throwing part for invalid getbbox() and make the returned values be 0 for width/height and x/y So reading about what is written in the bounding box section. > Even if an element is not in the [rendering tree](https://svgwg.org/svg2-draft/render.html#RenderingTree) – due to it being 'display: none', within a ‘[defs](https://svgwg.org/svg2-draft/struct.html#DefsElement)’ element, not usually rendered like a ‘[symbol](https://svgwg.org/svg2-draft/struct.html#SymbolElement)’ element or not currently present in the document tree – it still has a bounding box. A call to [getBBox](https://svgwg.org/svg2-draft/types.html#__svg__SVGGraphicsElement__getBBox) on the element will return the same rectangle as if the element were rendered. However, an element that is not in the [rendering tree](https://svgwg.org/svg2-draft/render.html#RenderingTree) does not contribute to the bounding box of any ancestor element. that's an interesting case. so has dimensions but not visible. This is a valid bbox so it returns data. Then there is the quote you found: > An element which has zero width, zero height, or both (such as a vertical or horizontal line, or a ‘[rect](https://svgwg.org/svg2-draft/shapes.html#RectElement)’ element with a zero [width](https://svgwg.org/svg2-draft/geometry.html#Sizing) or [height](https://svgwg.org/svg2-draft/geometry.html#Sizing)) still has a bounding box, with a positive value for the positive dimension, or with '0' for both the width and height if no positive dimension is specified. I don't understand this part is not part of the parsing algorithm below in this section :/ Should it be? Or should this paragraph be rewritten has an algorithm? What are all the possible cases: * `<rect id="rect1" x="10" y="20" width="30" height="40"/>` * `<rect id="rect1" x="10" y="20" width="-30" height="40"/>` * `<rect id="rect1" x="10" y="20" width="-30" height="-40"/>` * `<rect id="rect1" x="10" y="20" width="0" height="40"/>` * `<rect id="rect1" x="10" y="20" width="0" height="0"/>` * `<rect id="rect1" x="10" y="20" height="40"/>` * `<rect id="rect1" x="10" y="20"/>` In the resolution, we are currently saying. * Remove: "If [getBBox](https://svgwg.org/svg2-draft/types.html#__svg__SVGGraphicsElement__getBBox) gets called on a [non-rendered element](https://svgwg.org/svg2-draft/render.html#TermNonRenderedElement), and the UA is not able to compute the geometry of the element, then throw an [InvalidStateError](https://heycam.github.io/webidl/#invalidstateerror)." * Let's assign 0 to the returned value if the attribute is missing, or is negative. Your question is the case for `width="0" height="40"` aka should it return `(0, 40)` or `(0, 0)` Let's put it back on the agenda. :D Thanks @goldenboy777 for your sharp eye. -- GitHub Notification of comment by karlcow Please view or discuss this issue at https://github.com/w3c/svgwg/issues/1018#issuecomment-3466145898 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Thursday, 30 October 2025 05:06:51 UTC