Performance: Striped and hover tables
LOW IMPACT
This affects the rendering speed and visual stability of tables by adding background color styles for rows.
<table class="table table-striped table-hover"> <tbody> <tr><td>Row 1</td></tr> <tr><td>Row 2</td></tr> <tr><td>Row 3</td></tr> </tbody> </table>
<table> <tr style="background-color:#f8f9fa"><td>Row 1</td></tr> <tr><td>Row 2</td></tr> <tr style="background-color:#f8f9fa"><td>Row 3</td></tr> </table>
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Inline styles with JS hover | Minimal DOM ops | Multiple reflows on hover | High paint cost on hover | [X] Bad |
| Bootstrap .table-striped and .table-hover | Minimal DOM ops | No reflows on hover | Low paint cost on hover | [OK] Good |