mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
pref(table): prevent unnecessary reflow with sticky row (#12786)
The offset of a sticky row is calculated by summing up the heights of the previous sticky rows. As the access to the height causes a forced reflow this is now skipped when there is only one row.
This commit is contained in:
@@ -140,6 +140,10 @@ export class StickyStyler {
|
||||
this._addStickyStyle(row, position, stickyHeight);
|
||||
}
|
||||
|
||||
if (rowIndex === rows.length - 1) {
|
||||
// prevent unnecessary reflow from getBoundingClientRect()
|
||||
return;
|
||||
}
|
||||
stickyHeight += row.getBoundingClientRect().height;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user