diff --git a/src/cdk/table/sticky-styler.ts b/src/cdk/table/sticky-styler.ts index eebe0b8ec3ea..2f50569e9207 100644 --- a/src/cdk/table/sticky-styler.ts +++ b/src/cdk/table/sticky-styler.ts @@ -330,6 +330,10 @@ export class StickyStyler { * sticky position if there are no more directions. */ _removeStickyStyle(element: HTMLElement, stickyDirections: StickyDirection[]) { + if (!element.classList.contains(this._stickCellCss)) { + return; + } + for (const dir of stickyDirections) { element.style[dir] = ''; element.classList.remove(this._borderCellCss[dir]);