Rules Hub
Coding Rules Library
← Back to all rules
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
frontend ruleP2universalStack: css
cssselectorsspecificitycleanup
Do not add a class selector alongside a unique id selector
When selecting by a unique id you don't also need a class qualifier; the id already uniquely identifies the element.
PR: hegnar-forum-web · org-mining-hist-2026-06Created: Jun 20, 2026
Bad example
Old codetypescript
| 1 | const header = document.querySelector('#header').querySelector('.sticky'); |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | const header = document.querySelector('#header'); |
Explanation (EN)
Objašnjenje (HR)