-
Notifications
You must be signed in to change notification settings - Fork 49.8k
Add getClientRects to fragment instances #32660
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Comparing: c69a5fc...e9375b4 Critical size changesIncludes critical production bundles, as well as any change greater than 2%:
Significant size changesIncludes any change greater than 0.2%: (No significant changes) |
| blur(): void, | ||
| observeUsing(observer: IntersectionObserver | ResizeObserver): void, | ||
| unobserveUsing(observer: IntersectionObserver | ResizeObserver): void, | ||
| getClientRects(): ChildRectLists, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should really be Array<DOMRect> and we have to flatten it.
Otherwise you can't pass this instance to an API expecting an Element that it reads the rects from. Whatever methods that already exist on Elements need to have the same exact signature (almost).
Technically it should be a DOMRectList which is array-like but it doesn't have the prototype of an actual array. It also has an item() method that arrays don't have. Unfortunately you can't instantiate one of these yourself very easily but in practice we can expect that consumers use the array-like indexing.
So I think it's ok for this to be a flat Array<DOMRect>.
38f410a to
e9375b4
Compare
Adds
getClientRects()to fragment instances with a fixture test case.Element.getClientRectreturns a collection ofDOMRects (see example of multiline span returning twoDOMRectboxes).fragmentInstance.getClientRectshere flattens those collections into an array of rects.