Skip to content

Commit

Permalink
minor revisions
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewseguin committed Jun 5, 2018
1 parent 7ed0e10 commit 9a85a3d
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/cdk/table/sticky-styler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export class StickyStyler {
* @param stickyDirections The directions that should no longer be set as sticky on the rows.
*/
clearStickyPositioning(rows: HTMLElement[], stickyDirections: StickyDirection[]) {
for (let row of rows) {
for (const row of rows) {
this._removeStickyStyle(row, stickyDirections);
for (let i = 0; i < row.children.length; i++) {
const cell = row.children[i] as HTMLElement;
Expand All @@ -70,13 +70,15 @@ export class StickyStyler {
return;
}

const numCells = rows[0].children.length;
const cellWidths: number[] = this._getCellWidths(rows[0]);
const firstRow = rows[0];
const numCells = firstRow.children.length;
const cellWidths: number[] = this._getCellWidths(firstRow);

const startPositions = this._getStickyStartColumnPositions(cellWidths, stickyStartStates);
const endPositions = this._getStickyEndColumnPositions(cellWidths, stickyEndStates);
const isRtl = this.direction === 'rtl';

for (let row of rows) {
for (const row of rows) {
for (let i = 0; i < numCells; i++) {
const cell = row.children[i] as HTMLElement;
if (stickyStartStates[i]) {
Expand Down Expand Up @@ -153,7 +155,7 @@ export class StickyStyler {
* sticky position if there are no more directions.
*/
_removeStickyStyle(element: HTMLElement, stickyDirections: StickyDirection[]) {
for (let dir of stickyDirections) {
for (const dir of stickyDirections) {
element.style[dir] = '';
}
element.style.zIndex = this._getCalculatedZIndex(element);
Expand Down Expand Up @@ -199,7 +201,7 @@ export class StickyStyler {
};

let zIndex = 0;
for (let dir of STICKY_DIRECTIONS) {
for (const dir of STICKY_DIRECTIONS) {
if (element.style[dir]) {
zIndex += zIndexIncrements[dir];
}
Expand Down

0 comments on commit 9a85a3d

Please sign in to comment.