Performance: Cell merging
MEDIUM IMPACT
Cell merging affects layout calculation and painting performance because it changes how table cells span multiple rows or columns.
<table> <thead> <tr><th colspan="2">Merged Header</th></tr> </thead> <tbody> <tr><td>Data 1</td><td>Data 2</td></tr> <tr><td>Data 3</td><td>Data 4</td></tr> </tbody> </table>
<table> <tr> <td rowspan="10">Merged Cell</td> <td>Data 1</td> </tr> <tr> <td>Data 2</td> </tr> <!-- many more rows --> </table>
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Large rowspan/colspan in many rows | Moderate DOM nodes | Multiple reflows proportional to span | High paint cost due to complex layout | [X] Bad |
| Merged headers with colspan | Fewer DOM nodes | Single reflow for header | Lower paint cost | [OK] Good |