Performance: Not selector
MEDIUM IMPACT
The :not() selector affects CSS selector matching speed and style calculation during page rendering.
div { color: blue; } .exclude { color: initial; }div:not(.exclude) { color: blue; }
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| :not() with simple class | Low | 1 if style changes | Low | [OK] Good |
| :not() with multiple complex selectors | Medium | Multiple if style changes | Medium | [!] OK |
| Separate styles without :not() | Low | 1 if style changes | Low | [OK] Good |