@@ -15,28 +15,28 @@ function easeOutCubic(t: number, b: number, c: number, d: number): number {
1515/**
1616 * @private
1717 */
18- function getScrollTop ( el : Element ) : number {
18+ function getScrollTop ( el : HTMLElement ) : number {
1919 return isDocumentElement ( el ) ? window . pageYOffset : el . scrollTop ;
2020}
2121
2222/**
2323 * @private
2424 */
25- function scrollTo ( el : Element , top : number ) : void {
25+ function scrollTo ( el : HTMLElement , top : number ) : void {
2626 isDocumentElement ( el ) ? window . scrollTo ( 0 , top ) : ( el . scrollTop = top ) ;
2727}
2828
2929/**
3030 * @private
3131 */
32- function isDocumentElement ( el : Element | typeof window ) : boolean {
32+ function isDocumentElement ( el : HTMLElement | typeof window ) : boolean {
3333 return el === document . body || el === document . documentElement || el === window ;
3434}
3535
3636/**
3737 * @private
3838 */
39- function getScrollParent ( el : Element ) : Element {
39+ function getScrollParent ( el : HTMLElement ) : HTMLElement {
4040 let style = getComputedStyle ( el ) ;
4141 const isParentAbs = style . position === 'absolute' ;
4242 const overflowRegExp = / ( a u t o | s c r o l l ) / ;
@@ -45,7 +45,7 @@ function getScrollParent(el: Element): Element {
4545 return document . documentElement ;
4646 }
4747
48- for ( let parent : Element | null = el ; ( parent = parent ?. parentElement ) ; ) {
48+ for ( let parent : HTMLElement | null = el ; ( parent = parent ?. parentElement ) ; ) {
4949 style = getComputedStyle ( parent ) ;
5050 if (
5151 ! ( isParentAbs && style . position === 'static' ) &&
@@ -62,7 +62,7 @@ function getScrollParent(el: Element): Element {
6262 * @private
6363 */
6464function smoothScrollTo (
65- el : Element ,
65+ el : HTMLElement ,
6666 to : number ,
6767 duration : number = 300 ,
6868 callback ?: CallbackFn
@@ -87,8 +87,8 @@ function smoothScrollTo(
8787 */
8888export const calculateMenuTop = (
8989 menuHeight : number ,
90- menuEl : Element | null ,
91- controlEl : Element | null
90+ menuEl : HTMLElement | null ,
91+ controlEl : HTMLElement | null
9292) : string => {
9393 const menuElStyle = menuEl && getComputedStyle ( menuEl ) ;
9494 const marginBottom = menuElStyle ? parseInt ( menuElStyle . marginBottom , 10 ) : 0 ;
@@ -101,7 +101,7 @@ export const calculateMenuTop = (
101101 return `calc(${ basePx } px + ${ adjustPx } px)` ;
102102} ;
103103
104- export const menuFitsBelowControl = ( el : Element | null ) : boolean => {
104+ export const menuFitsBelowControl = ( el : HTMLElement | null ) : boolean => {
105105 if ( ! el ) return true ;
106106
107107 const scrollParent = getScrollParent ( el ) ;
@@ -117,7 +117,7 @@ export const menuFitsBelowControl = (el: Element | null): boolean => {
117117 * scroll can performed to show the menu in full view. Also, execute a callback if defined.
118118 */
119119export const scrollMenuIntoViewOnOpen = (
120- menuEl : Element | null ,
120+ menuEl : HTMLElement | null ,
121121 menuScrollDuration : number | undefined ,
122122 scrollMenuIntoView : boolean | undefined ,
123123 handleOnMenuOpen : ( availableSpace ?: number ) => void
0 commit comments