From fe54d55fb3a802c72f182ab57dc9dff15ae049e9 Mon Sep 17 00:00:00 2001 From: Karl Seamon Date: Tue, 11 Feb 2025 15:19:29 -0500 Subject: [PATCH] perf(cdk/table): Short circuit _removeStickyStyle calls against elements with no sticky styles --- src/cdk/table/sticky-styler.ts | 4 ++++ 1 file changed, 4 insertions(+) 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]);