@@ -188,37 +188,38 @@ export class StickyStyler {
188
188
return ;
189
189
}
190
190
191
- // If positioning the rows to the bottom, reverse their order when evaluating the sticky
192
- // position such that the last row stuck will be "bottom: 0px" and so on. Note that the
193
- // sticky states need to be reversed as well.
194
- const rows = position === 'bottom' ? rowsToStick . slice ( ) . reverse ( ) : rowsToStick ;
195
- const states = position === 'bottom' ? stickyStates . slice ( ) . reverse ( ) : stickyStates ;
196
-
197
- // Measure row heights all at once before adding sticky styles to reduce layout thrashing.
198
- const stickyOffsets : number [ ] = [ ] ;
199
- const stickyCellHeights : ( number | undefined ) [ ] = [ ] ;
200
- const elementsToStick : HTMLElement [ ] [ ] = [ ] ;
201
- for ( let rowIndex = 0 , stickyOffset = 0 ; rowIndex < rows . length ; rowIndex ++ ) {
202
- if ( ! states [ rowIndex ] ) {
203
- continue ;
204
- }
191
+ // Coalesce with other sticky row updates (top/bottom), sticky columns updates
192
+ // (and potentially other changes like column resize).
193
+ this . _coalescedStyleScheduler . schedule ( ( ) => {
194
+ // If positioning the rows to the bottom, reverse their order when evaluating the sticky
195
+ // position such that the last row stuck will be "bottom: 0px" and so on. Note that the
196
+ // sticky states need to be reversed as well.
197
+ const rows = position === 'bottom' ? rowsToStick . slice ( ) . reverse ( ) : rowsToStick ;
198
+ const states = position === 'bottom' ? stickyStates . slice ( ) . reverse ( ) : stickyStates ;
199
+
200
+ // Measure row heights all at once before adding sticky styles to reduce layout thrashing.
201
+ const stickyOffsets : number [ ] = [ ] ;
202
+ const stickyCellHeights : ( number | undefined ) [ ] = [ ] ;
203
+ const elementsToStick : HTMLElement [ ] [ ] = [ ] ;
204
+
205
+ for ( let rowIndex = 0 , stickyOffset = 0 ; rowIndex < rows . length ; rowIndex ++ ) {
206
+ if ( ! states [ rowIndex ] ) {
207
+ continue ;
208
+ }
205
209
206
- stickyOffsets [ rowIndex ] = stickyOffset ;
207
- const row = rows [ rowIndex ] ;
208
- elementsToStick [ rowIndex ] = this . _isNativeHtmlTable
209
- ? ( Array . from ( row . children ) as HTMLElement [ ] )
210
- : [ row ] ;
210
+ stickyOffsets [ rowIndex ] = stickyOffset ;
211
+ const row = rows [ rowIndex ] ;
212
+ elementsToStick [ rowIndex ] = this . _isNativeHtmlTable
213
+ ? ( Array . from ( row . children ) as HTMLElement [ ] )
214
+ : [ row ] ;
211
215
212
- const height = row . getBoundingClientRect ( ) . height ;
213
- stickyOffset += height ;
214
- stickyCellHeights [ rowIndex ] = height ;
215
- }
216
+ const height = row . getBoundingClientRect ( ) . height ;
217
+ stickyOffset += height ;
218
+ stickyCellHeights [ rowIndex ] = height ;
219
+ }
216
220
217
- const borderedRowIndex = states . lastIndexOf ( true ) ;
221
+ const borderedRowIndex = states . lastIndexOf ( true ) ;
218
222
219
- // Coalesce with other sticky row updates (top/bottom), sticky columns updates
220
- // (and potentially other changes like column resize).
221
- this . _coalescedStyleScheduler . schedule ( ( ) => {
222
223
for ( let rowIndex = 0 ; rowIndex < rows . length ; rowIndex ++ ) {
223
224
if ( ! states [ rowIndex ] ) {
224
225
continue ;
0 commit comments