MCPcopy Index your code
hub / github.com/gridstack/gridstack.js / getScrollElement

Method getScrollElement

src/utils.ts:573–581  ·  view source on GitHub ↗

@internal returns the passed element if vertically scrollable, else the closest parent that will, up to the entire document scrolling element

(el?: HTMLElement)

Source from the content-addressed store, hash-verified

571
572 /** @internal returns the passed element if vertically scrollable, else the closest parent that will, up to the entire document scrolling element */
573 static getScrollElement(el?: HTMLElement): HTMLElement {
574 if (!el) return document.scrollingElement as HTMLElement || document.documentElement; // IE support
575 const overflowY = getComputedStyle(el).overflowY;
576 if ((overflowY === 'auto' || overflowY === 'scroll') && el.scrollHeight > el.clientHeight) {
577 return el;
578 } else {
579 return Utils.getScrollElement(el.parentElement);
580 }
581 }
582
583 /**
584 * @internal Function used to scroll the page.

Callers 4

updateScrollPositionMethod · 0.80
updateScrollResizeMethod · 0.80
_resizeStartMethod · 0.80
utils-spec.tsFile · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected