MCPcopy Create free account
hub / github.com/bvaughn/react-virtualized / getLayoutHeight

Function getLayoutHeight

lib/utils/test/scrollElement.ts:52–70  ·  view source on GitHub ↗
(element: Element)

Source from the content-addressed store, hash-verified

50}
51
52function getLayoutHeight(element: Element): number {
53 const containerRect = containerRects.get(element);
54 if (containerRect) {
55 return containerRect.height;
56 }
57
58 const height = parsePixels(getStyle(element)?.height ?? "");
59 if (height !== null) {
60 return height;
61 }
62
63 let sum = 0;
64 for (const child of Array.from(element.children)) {
65 if (!isAbsolutelyPositioned(child)) {
66 sum += getLayoutHeight(child);
67 }
68 }
69 return sum;
70}
71
72// The top of the element relative to the top of the root (e.g. the content of a scroll container)
73function getLayoutTop(element: Element, root: Element): number {

Callers 2

getLayoutTopFunction · 0.85
getBoundingClientRectFunction · 0.85

Calls 3

parsePixelsFunction · 0.85
getStyleFunction · 0.85
isAbsolutelyPositionedFunction · 0.85

Tested by

no test coverage detected