The current restriction of use:resize to just HTMLElement is very unfortunate, since for SVG elements Svelte doesn't even provide an equivalent to bind:clientWidth/bind:clientHeight), so use:resize would be even more useful here.
The ResizeObserver constructor creates a new ResizeObserver object, which can be used to report changes to the content or border box of an Element or the bounding box of an SVGElement.
Web content can also contain SVG elements. SVG Elements define bounding box instead of a content box. Content rect for SVGGraphicsElements is a rect whose:
The
ResizeObserver
Web API supportsElement
, not justHTMLElement
.The current restriction of
use:resize
to justHTMLElement
is very unfortunate, since for SVG elements Svelte doesn't even provide an equivalent tobind:clientWidth
/bind:clientHeight
), souse:resize
would be even more useful here.Additional sources:
MDN Web Docs
W3C "Resize Observer" Spec