-
fix: guard layoutWidth/Height with HTMLElement instanceof check
发布于
2026-04-19 02:31:58 +00:00 offsetWidth/offsetHeight are only defined on HTMLElement (not on
SVGElement, MathMLElement, etc.). Casting unconditionally can yield
undefined-by-runtime even though TypeScript thinks otherwise. Use an
instanceof check and fall back to the bounding rect dimensions when the
element is not an HTMLElement.Addresses deferred review feedback from PR #290.
下载附件