@@ -35,6 +35,9 @@ export class StickyStyler {
35
35
* @param direction The directionality context of the table (ltr/rtl); affects column positioning
36
36
* by reversing left/right positions.
37
37
* @param _isBrowser Whether the table is currently being rendered on the server or the client.
38
+ * @param _needsPositionStickyOnElement Whether we need to specify position: sticky on cells
39
+ * using inline styles. If false, it is assumed that position: sticky is included in
40
+ * the component stylesheet for _stickCellCss.
38
41
*/
39
42
constructor ( private _isNativeHtmlTable : boolean ,
40
43
private _stickCellCss : string ,
@@ -209,11 +212,14 @@ export class StickyStyler {
209
212
210
213
// If the element no longer has any more sticky directions, remove sticky positioning and
211
214
// the sticky CSS class.
215
+ // Short-circuit checking element.style[dir] for stickyDirections as they
216
+ // were already removed above.
212
217
const hasDirection = STICKY_DIRECTIONS . some ( dir =>
213
- stickyDirections . indexOf ( dir ) === - 1 && ! ! element . style [ dir ] ) ;
218
+ stickyDirections . indexOf ( dir ) === - 1 && element . style [ dir ] ) ;
214
219
if ( hasDirection ) {
215
220
element . style . zIndex = this . _getCalculatedZIndex ( element ) ;
216
221
} else {
222
+ // When not hasDirection, _getCalculatedZIndex will always return ''.
217
223
element . style . zIndex = '' ;
218
224
if ( this . _needsPositionStickyOnElement ) {
219
225
element . style . position = '' ;
0 commit comments