export function getNodeName ( element ) { return element ? ( element . nodeName || '' ) . toLowerCase ( ) : null ; } export function getParentNode ( el ) { if ( getNodeName ( el ) === 'html' ) return el ; return ( el . parentNode || document . ownerDocument || document . documentElement ) as HTMLElement ; } export function isBody ( node ) { const name = getNodeName ( node ) ; return name === 'body' || name === 'html' ; } export function isNode ( node ) { return node instanceof window . Node ; } export function getScrollParents ( node , list = [ ] ) { if ( isBody ( node ) ) return list ; if ( isNode ( node ) ) { const { overflow , overflowX , overflowY } = getComputedStyle ( node ) ; if ( /auto|scroll|overlay|hidden/ . test ( overflow + overflowY + overflowX ) ) { list . push ( node ) ; } } return getScrollParents ( getParentNode ( node ) , list ) ; }