File tree Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -149,8 +149,9 @@ class Adapter {
149149 calculateProperties ( ) {
150150 let rowTop = null , topHeight = 0 ;
151151 let topDone = false , bottomDone = false ;
152+ const length = this . buffer . length ;
152153
153- for ( let i = 0 ; i < this . buffer . length ; i ++ ) {
154+ for ( let i = 0 ; i < length ; i ++ ) {
154155 const item = this . buffer [ i ] ;
155156 const itemTop = item . element . offset ( ) . top ;
156157
@@ -165,7 +166,7 @@ class Adapter {
165166 this [ 'topVisibleScope' ] = item . scope ;
166167 }
167168
168- if ( ! bottomDone && top > this . viewport . bottomVisiblePos ( ) ) {
169+ if ( ! bottomDone && ( top >= this . viewport . bottomVisiblePos ( ) || ( i === length - 1 && this . isEOF ( ) ) ) ) {
169170 bottomDone = true ;
170171 this [ 'bottomVisible' ] = item . item ;
171172 this [ 'bottomVisibleElement' ] = item . element ;
Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ describe('uiScroll', function () {
2727
2828 expect ( scope . adapter ) . toBeTruthy ( ) ;
2929 expect ( scope . adapter . topVisibleElement [ 0 ] . innerHTML ) . toBe ( '1: one' ) ;
30+ expect ( scope . adapter . bottomVisibleElement [ 0 ] . innerHTML ) . toBe ( '3: three' ) ;
3031 }
3132 ) ;
3233 } ) ;
You can’t perform that action at this time.
0 commit comments