Performance: Class attribute
MEDIUM IMPACT
The class attribute affects CSS selector matching and DOM updates, impacting rendering speed and style recalculations.
<div class="btn btn-primary btn-large"></div>
<div class="btn btn-primary btn-large btn-primary btn-large"></div>
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Duplicated class names | No extra DOM nodes | Multiple style recalculations | Higher paint cost due to style thrashing | [X] Bad |
| Unique, simple class names | No extra DOM nodes | Single style recalculation | Lower paint cost with stable styles | [OK] Good |