@@ -46,17 +46,17 @@ export type CustomScrollBehaviorCallback<T = unknown> = (
46
46
actions : ScrollAction [ ]
47
47
) => T
48
48
49
- let isStandardScrollBehavior = (
49
+ const isStandardScrollBehavior = (
50
50
options : any
51
51
) : options is StandardBehaviorOptions =>
52
52
options === Object ( options ) && Object . keys ( options ) . length !== 0
53
53
54
- let isCustomScrollBehavior = < T = unknown > (
54
+ const isCustomScrollBehavior = < T = unknown > (
55
55
options : any
56
56
) : options is CustomBehaviorOptions < T > =>
57
57
typeof options === 'object' ? typeof options . behavior === 'function' : false
58
58
59
- let getOptions = ( options : any ) : StandardBehaviorOptions => {
59
+ const getOptions = ( options : any ) : StandardBehaviorOptions => {
60
60
// Handle alignToTop for legacy reasons, to be compatible with the spec
61
61
if ( options === false ) {
62
62
return { block : 'end' , inline : 'nearest' }
@@ -75,7 +75,7 @@ let getOptions = (options: any): StandardBehaviorOptions => {
75
75
// Derived from code of Andy Desmarais
76
76
// https://terodox.tech/how-to-tell-if-an-element-is-in-the-dom-including-the-shadow-dom/
77
77
const isInDocument = ( element : Node ) => {
78
- var currentElement = element
78
+ let currentElement = element
79
79
while ( currentElement && currentElement . parentNode ) {
80
80
if ( currentElement . parentNode === document ) {
81
81
return true
@@ -131,8 +131,9 @@ function scrollIntoView<T = unknown>(
131
131
return options . behavior ( compute ( target , options ) )
132
132
}
133
133
134
- let behavior = typeof options === 'boolean' ? undefined : options ?. behavior
135
- for ( let { el, top, left } of compute ( target , getOptions ( options ) ) ) {
134
+ const behavior = typeof options === 'boolean' ? undefined : options ?. behavior
135
+
136
+ for ( const { el, top, left } of compute ( target , getOptions ( options ) ) ) {
136
137
el . scroll ( { top, left, behavior } )
137
138
}
138
139
}
0 commit comments