utils/dom/findclosestscrollableancestor
module
Functions
findClosestScrollableAncestor( domElement ) → HTMLElement | nullmodule:utils/dom/findclosestscrollableancestor~findClosestScrollableAncestorReturns the closest scrollable ancestor of a DOM element.
The search crosses shadow DOM boundaries, continuing from the host element of a shadow root instead of stopping at it. Without that, an element rendered inside a shadow tree would report no scrollable ancestor at all, even when one exists further up in the surrounding document, because the walk goes over
parentElement, which isnullfor a direct child of a shadow root. Works for both open and closed shadow roots.Parameters
domElement: HTMLElementDOM element.
Returns
HTMLElement | nullFirst ancestor of
domElementthat is scrollable or null if such ancestor doesn't exist.