SVG element resize event

Due to SVG’s inadequate layout capabilities, developers often have to layout the contents of things like infographics in script, using libraries like D3. When the dimensions of the host SVG element changes, it is necessary to redraw the contents to fit, but the SVGResize event only fires when the resize is triggered by the document, rather than something like a parent flexbox or a change to a width/height specified via CSS.

When the size of an SVG element is being controlled externally, it should be possible to detect changes regardless of the cause.

Can’t you use a resize listener on the parent element?

There is no way to attach a resize listener to an element, only to the window.

If it’s CSS that resizes the svg container, then it should be CSS that provides such a notification, if any. The SVGResize event is the same as the resize event on the document view, it’s not handling resizing on the element level.

The CSS Houdini Taskforce might be a good place to bring this request, see https://wiki.css-houdini.org/.