Skip to content

Commit 9a85a3d

Browse files
committed
minor revisions
1 parent 7ed0e10 commit 9a85a3d

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/cdk/table/sticky-styler.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export class StickyStyler {
4444
* @param stickyDirections The directions that should no longer be set as sticky on the rows.
4545
*/
4646
clearStickyPositioning(rows: HTMLElement[], stickyDirections: StickyDirection[]) {
47-
for (let row of rows) {
47+
for (const row of rows) {
4848
this._removeStickyStyle(row, stickyDirections);
4949
for (let i = 0; i < row.children.length; i++) {
5050
const cell = row.children[i] as HTMLElement;
@@ -70,13 +70,15 @@ export class StickyStyler {
7070
return;
7171
}
7272

73-
const numCells = rows[0].children.length;
74-
const cellWidths: number[] = this._getCellWidths(rows[0]);
73+
const firstRow = rows[0];
74+
const numCells = firstRow.children.length;
75+
const cellWidths: number[] = this._getCellWidths(firstRow);
76+
7577
const startPositions = this._getStickyStartColumnPositions(cellWidths, stickyStartStates);
7678
const endPositions = this._getStickyEndColumnPositions(cellWidths, stickyEndStates);
7779
const isRtl = this.direction === 'rtl';
7880

79-
for (let row of rows) {
81+
for (const row of rows) {
8082
for (let i = 0; i < numCells; i++) {
8183
const cell = row.children[i] as HTMLElement;
8284
if (stickyStartStates[i]) {
@@ -153,7 +155,7 @@ export class StickyStyler {
153155
* sticky position if there are no more directions.
154156
*/
155157
_removeStickyStyle(element: HTMLElement, stickyDirections: StickyDirection[]) {
156-
for (let dir of stickyDirections) {
158+
for (const dir of stickyDirections) {
157159
element.style[dir] = '';
158160
}
159161
element.style.zIndex = this._getCalculatedZIndex(element);
@@ -199,7 +201,7 @@ export class StickyStyler {
199201
};
200202

201203
let zIndex = 0;
202-
for (let dir of STICKY_DIRECTIONS) {
204+
for (const dir of STICKY_DIRECTIONS) {
203205
if (element.style[dir]) {
204206
zIndex += zIndexIncrements[dir];
205207
}

0 commit comments

Comments
 (0)