* Removes the sticky style on the element by removing the sticky cell CSS class, re-evaluating * the zIndex, removing each of the provided sticky directions, and removing the * sticky position if there are no more directions.
(element: HTMLElement, stickyDirections: StickyDirection[])
| 349 | * sticky position if there are no more directions. |
| 350 | */ |
| 351 | _removeStickyStyle(element: HTMLElement, stickyDirections: StickyDirection[]) { |
| 352 | if (!element.classList.contains(this._stickCellCss)) { |
| 353 | return; |
| 354 | } |
| 355 | |
| 356 | for (const dir of stickyDirections) { |
| 357 | element.style[dir] = ''; |
| 358 | element.classList.remove(this._borderCellCss[dir]); |
| 359 | } |
| 360 | |
| 361 | // If the element no longer has any more sticky directions, remove sticky positioning and |
| 362 | // the sticky CSS class. |
| 363 | // Short-circuit checking element.style[dir] for stickyDirections as they |
| 364 | // were already removed above. |
| 365 | const hasDirection = STICKY_DIRECTIONS.some( |
| 366 | dir => stickyDirections.indexOf(dir) === -1 && element.style[dir], |
| 367 | ); |
| 368 | if (hasDirection) { |
| 369 | element.style.zIndex = this._getCalculatedZIndex(element); |
| 370 | } else { |
| 371 | // When not hasDirection, _getCalculatedZIndex will always return ''. |
| 372 | element.style.zIndex = ''; |
| 373 | if (this._needsPositionStickyOnElement) { |
| 374 | element.style.position = ''; |
| 375 | } |
| 376 | element.classList.remove(this._stickCellCss); |
| 377 | } |
| 378 | } |
| 379 | |
| 380 | /** |
| 381 | * Adds the sticky styling to the element by adding the sticky style class, changing position |
no test coverage detected