getBBox method
The SVGGraphicsElement.getBBox()
method allows us to determine
the coordinates of the smallest rectangle in which the object fits. The
coordinates
returned are with respect to the current SVG space (after the application
of all
geometry attributes on all the elements contained in the target element).
Note:
getBBox()
must return the actual bounding box at the time the method was called—even in case the element has not yet been rendered. It also does not account for any transformation applied to the element or its parents.
Note:
getBBox
returns different values than Element.getBoundingClientRect, as the latter returns value relative to the viewport
Implementation
external DOMRect getBBox([SVGBoundingBoxOptions options]);