param element export const getDocument = ( element = window ) : Element => { return ( element instanceof Window ? element . document : element . ownerDocument ) . documentElement ; } ; param element export const getNodeName = ( element ? ) : string => { return element && ! ( element instanceof Window ) ? ( element . nodeName ) . toLowerCase ( ) : '' ; } ; param element export const getParentNode = ( element ) : Node => { if ( getNodeName ( element ) === 'html' ) return element ; return ( window . ShadowRoot ? element instanceof ShadowRoot ? element . host : element . assignedSlot || element . parentNode : element . parentNode ) || getDocument ( element as Element ) ; } ;