@@ -166,7 +166,7 @@ export const ironList = {
166166 * The height of the physical content that isn't on the screen.
167167 */
168168 get _hiddenContentSize ( ) {
169- var size = this . grid ? this . _physicalRows * this . _rowHeight : this . _physicalSize ;
169+ const size = this . grid ? this . _physicalRows * this . _rowHeight : this . _physicalSize ;
170170 return size - this . _viewportHeight ;
171171 } ,
172172
@@ -182,7 +182,7 @@ export const ironList = {
182182 * `_physicalStart`.
183183 */
184184 get _maxVirtualStart ( ) {
185- var virtualCount = this . _convertIndexToCompleteRow ( this . _virtualCount ) ;
185+ const virtualCount = this . _convertIndexToCompleteRow ( this . _virtualCount ) ;
186186 return Math . max ( 0 , virtualCount - this . _physicalCount ) ;
187187 } ,
188188
@@ -255,9 +255,9 @@ export const ironList = {
255255 * @type {number }
256256 */
257257 get firstVisibleIndex ( ) {
258- var idx = this . _firstVisibleIndexVal ;
258+ let idx = this . _firstVisibleIndexVal ;
259259 if ( idx == null ) {
260- var physicalOffset = this . _physicalTop + this . _scrollOffset ;
260+ let physicalOffset = this . _physicalTop + this . _scrollOffset ;
261261
262262 idx =
263263 this . _iterateItems ( ( pidx , vidx ) => {
@@ -282,12 +282,12 @@ export const ironList = {
282282 * @type {number }
283283 */
284284 get lastVisibleIndex ( ) {
285- var idx = this . _lastVisibleIndexVal ;
285+ let idx = this . _lastVisibleIndexVal ;
286286 if ( idx == null ) {
287287 if ( this . grid ) {
288288 idx = Math . min ( this . _virtualCount , this . firstVisibleIndex + this . _estRowsInView * this . _itemsPerRow - 1 ) ;
289289 } else {
290- var physicalOffset = this . _physicalTop + this . _scrollOffset ;
290+ let physicalOffset = this . _physicalTop + this . _scrollOffset ;
291291 this . _iterateItems ( ( pidx , vidx ) => {
292292 if ( physicalOffset < this . _scrollBottom ) {
293293 idx = vidx ;
@@ -324,9 +324,9 @@ export const ironList = {
324324 * Recycles the physical items when needed.
325325 */
326326 _scrollHandler : function ( ) {
327- var scrollTop = Math . max ( 0 , Math . min ( this . _maxScrollTop , this . _scrollTop ) ) ;
328- var delta = scrollTop - this . _scrollPosition ;
329- var isScrollingDown = delta >= 0 ;
327+ const scrollTop = Math . max ( 0 , Math . min ( this . _maxScrollTop , this . _scrollTop ) ) ;
328+ let delta = scrollTop - this . _scrollPosition ;
329+ const isScrollingDown = delta >= 0 ;
330330 // Track the current scroll position.
331331 this . _scrollPosition = scrollTop ;
332332 // Clear indexes for first and last visible indexes.
@@ -335,7 +335,7 @@ export const ironList = {
335335 // Random access.
336336 if ( Math . abs ( delta ) > this . _physicalSize && this . _physicalSize > 0 ) {
337337 delta -= this . _scrollOffset ;
338- var idxAdjustment = Math . round ( delta / this . _physicalAverage ) * this . _itemsPerRow ;
338+ const idxAdjustment = Math . round ( delta / this . _physicalAverage ) * this . _itemsPerRow ;
339339 this . _virtualStart += idxAdjustment ;
340340 this . _physicalStart += idxAdjustment ;
341341 // Estimate new physical offset based on the virtual start index.
@@ -350,7 +350,7 @@ export const ironList = {
350350 ) ;
351351 this . _update ( ) ;
352352 } else if ( this . _physicalCount > 0 ) {
353- var reusables = this . _getReusables ( isScrollingDown ) ;
353+ const reusables = this . _getReusables ( isScrollingDown ) ;
354354 if ( isScrollingDown ) {
355355 this . _physicalTop = reusables . physicalTop ;
356356 this . _virtualStart += reusables . indexes . length ;
@@ -371,17 +371,17 @@ export const ironList = {
371371 * @param {boolean } fromTop If the potential reusable items are above the scrolling region.
372372 */
373373 _getReusables : function ( fromTop ) {
374- var ith , lastIth , offsetContent , physicalItemHeight ;
375- var idxs = [ ] ;
376- var protectedOffsetContent = this . _hiddenContentSize * this . _ratio ;
377- var virtualStart = this . _virtualStart ;
378- var virtualEnd = this . _virtualEnd ;
379- var physicalCount = this . _physicalCount ;
380- var top = this . _physicalTop + this . _scrollOffset ;
381- var bottom = this . _physicalBottom + this . _scrollOffset ;
374+ let ith , lastIth , offsetContent , physicalItemHeight ;
375+ const idxs = [ ] ;
376+ const protectedOffsetContent = this . _hiddenContentSize * this . _ratio ;
377+ const virtualStart = this . _virtualStart ;
378+ const virtualEnd = this . _virtualEnd ;
379+ const physicalCount = this . _physicalCount ;
380+ let top = this . _physicalTop + this . _scrollOffset ;
381+ const bottom = this . _physicalBottom + this . _scrollOffset ;
382382 // This may be called outside of a scrollHandler, so use last cached position
383- var scrollTop = this . _scrollPosition ;
384- var scrollBottom = this . _scrollBottom ;
383+ const scrollTop = this . _scrollPosition ;
384+ const scrollBottom = this . _scrollBottom ;
385385
386386 if ( fromTop ) {
387387 ith = this . _physicalStart ;
@@ -444,7 +444,7 @@ export const ironList = {
444444 // Adjust offset after measuring.
445445 if ( movingUp ) {
446446 while ( movingUp . length ) {
447- var idx = movingUp . pop ( ) ;
447+ const idx = movingUp . pop ( ) ;
448448 this . _physicalTop -= this . _getPhysicalSizeIncrement ( idx ) ;
449449 }
450450 }
@@ -464,32 +464,32 @@ export const ironList = {
464464 * Increases the pool size.
465465 */
466466 _increasePoolIfNeeded : function ( count ) {
467- var nextPhysicalCount = this . _clamp (
467+ let nextPhysicalCount = this . _clamp (
468468 this . _physicalCount + count ,
469469 DEFAULT_PHYSICAL_COUNT ,
470470 this . _virtualCount - this . _virtualStart ,
471471 ) ;
472472 nextPhysicalCount = this . _convertIndexToCompleteRow ( nextPhysicalCount ) ;
473473 if ( this . grid ) {
474- var correction = nextPhysicalCount % this . _itemsPerRow ;
474+ const correction = nextPhysicalCount % this . _itemsPerRow ;
475475 if ( correction && nextPhysicalCount - correction <= this . _physicalCount ) {
476476 nextPhysicalCount += this . _itemsPerRow ;
477477 }
478478 nextPhysicalCount -= correction ;
479479 }
480- var delta = nextPhysicalCount - this . _physicalCount ;
481- var nextIncrease = Math . round ( this . _physicalCount * 0.5 ) ;
480+ const delta = nextPhysicalCount - this . _physicalCount ;
481+ let nextIncrease = Math . round ( this . _physicalCount * 0.5 ) ;
482482
483483 if ( delta < 0 ) {
484484 return ;
485485 }
486486 if ( delta > 0 ) {
487- var ts = window . performance . now ( ) ;
487+ const ts = window . performance . now ( ) ;
488488 // Concat arrays in place.
489489 [ ] . push . apply ( this . _physicalItems , this . _createPool ( delta ) ) ;
490490 // Push 0s into physicalSizes. Can't use Array.fill because IE11 doesn't
491491 // support it.
492- for ( var i = 0 ; i < delta ; i ++ ) {
492+ for ( let i = 0 ; i < delta ; i ++ ) {
493493 this . _physicalSizes . push ( 0 ) ;
494494 }
495495 this . _physicalCount += delta ;
@@ -533,7 +533,7 @@ export const ironList = {
533533 return ;
534534 }
535535 if ( this . _physicalCount !== 0 ) {
536- var reusables = this . _getReusables ( true ) ;
536+ const reusables = this . _getReusables ( true ) ;
537537 this . _physicalTop = reusables . physicalTop ;
538538 this . _virtualStart += reusables . indexes . length ;
539539 this . _physicalStart += reusables . indexes . length ;
@@ -583,19 +583,19 @@ export const ironList = {
583583 this . _adjustVirtualIndex ( change . value . indexSplices ) ;
584584 this . _virtualCount = this . items ? this . items . length : 0 ;
585585 // Only blur if at least one item is added or removed.
586- var itemAddedOrRemoved = change . value . indexSplices . some ( ( splice ) => {
586+ const itemAddedOrRemoved = change . value . indexSplices . some ( ( splice ) => {
587587 return splice . addedCount > 0 || splice . removed . length > 0 ;
588588 } ) ;
589589 if ( itemAddedOrRemoved ) {
590590 // Only blur activeElement if it is a descendant of the list (#505,
591591 // #507).
592- var activeElement = this . _getActiveElement ( ) ;
592+ const activeElement = this . _getActiveElement ( ) ;
593593 if ( this . contains ( activeElement ) ) {
594594 activeElement . blur ( ) ;
595595 }
596596 }
597597 // Render only if the affected index is rendered.
598- var affectedIndexRendered = change . value . indexSplices . some ( ( splice ) => {
598+ const affectedIndexRendered = change . value . indexSplices . some ( ( splice ) => {
599599 return splice . index + splice . addedCount >= this . _virtualStart && splice . index <= this . _virtualEnd ;
600600 } ) ;
601601 if ( ! this . _isClientFull ( ) || affectedIndexRendered ) {
@@ -615,7 +615,7 @@ export const ironList = {
615615 * @param {!Array<number>= } itemSet
616616 */
617617 _iterateItems : function ( fn , itemSet ) {
618- var pidx , vidx , rtn , i ;
618+ let pidx , vidx , rtn , i ;
619619
620620 if ( arguments . length === 2 && itemSet ) {
621621 for ( i = 0 ; i < itemSet . length ; i ++ ) {
@@ -664,10 +664,10 @@ export const ironList = {
664664 // so we can measure them.
665665 flush ( ) ;
666666
667- var newPhysicalSize = 0 ;
668- var oldPhysicalSize = 0 ;
669- var prevAvgCount = this . _physicalAverageCount ;
670- var prevPhysicalAvg = this . _physicalAverage ;
667+ let newPhysicalSize = 0 ;
668+ let oldPhysicalSize = 0 ;
669+ const prevAvgCount = this . _physicalAverageCount ;
670+ const prevPhysicalAvg = this . _physicalAverage ;
671671
672672 // eslint-disable-next-line @typescript-eslint/no-unused-vars
673673 this . _iterateItems ( ( pidx , vidx ) => {
@@ -708,15 +708,15 @@ export const ironList = {
708708 _positionItems : function ( ) {
709709 this . _adjustScrollPosition ( ) ;
710710
711- var y = this . _physicalTop ;
711+ let y = this . _physicalTop ;
712712
713713 if ( this . grid ) {
714- var totalItemWidth = this . _itemsPerRow * this . _itemWidth ;
715- var rowOffset = ( this . _viewportWidth - totalItemWidth ) / 2 ;
714+ const totalItemWidth = this . _itemsPerRow * this . _itemWidth ;
715+ const rowOffset = ( this . _viewportWidth - totalItemWidth ) / 2 ;
716716
717717 this . _iterateItems ( ( pidx , vidx ) => {
718- var modulus = vidx % this . _itemsPerRow ;
719- var x = Math . floor ( modulus * this . _itemWidth + rowOffset ) ;
718+ const modulus = vidx % this . _itemsPerRow ;
719+ let x = Math . floor ( modulus * this . _itemWidth + rowOffset ) ;
720720 if ( this . _isRTL ) {
721721 x *= - 1 ;
722722 }
@@ -769,13 +769,13 @@ export const ironList = {
769769 * Adjusts the scroll position when it was overestimated.
770770 */
771771 _adjustScrollPosition : function ( ) {
772- var deltaHeight =
772+ const deltaHeight =
773773 this . _virtualStart === 0 ? this . _physicalTop : Math . min ( this . _scrollPosition + this . _physicalTop , 0 ) ;
774774 // Note: the delta can be positive or negative.
775775 if ( deltaHeight !== 0 ) {
776776 this . _physicalTop -= deltaHeight ;
777777 // This may be called outside of a scrollHandler, so use last cached position
778- var scrollTop = this . _scrollPosition ;
778+ const scrollTop = this . _scrollPosition ;
779779 // Juking scroll position during interial scrolling on iOS is no bueno
780780 if ( ! IOS_TOUCH_SCROLLING && scrollTop > 0 ) {
781781 this . _resetScrollPosition ( scrollTop - deltaHeight ) ;
@@ -843,10 +843,10 @@ export const ironList = {
843843 // Estimate new physical offset.
844844 this . _physicalTop = Math . floor ( this . _virtualStart / this . _itemsPerRow ) * this . _physicalAverage ;
845845
846- var currentTopItem = this . _physicalStart ;
847- var currentVirtualItem = this . _virtualStart ;
848- var targetOffsetTop = 0 ;
849- var hiddenContentSize = this . _hiddenContentSize ;
846+ let currentTopItem = this . _physicalStart ;
847+ let currentVirtualItem = this . _virtualStart ;
848+ let targetOffsetTop = 0 ;
849+ const hiddenContentSize = this . _hiddenContentSize ;
850850 // Scroll to the item as much as we can.
851851 while ( currentVirtualItem < idx && targetOffsetTop <= hiddenContentSize ) {
852852 targetOffsetTop += this . _getPhysicalSizeIncrement ( currentTopItem ) ;
0 commit comments