On circular dependencies in CSS
- Published:
Letting implementation complexity leak into the UI is a common antipattern.
ALL cycles can be detected by “keeping track of a dependency graph and using common cycle-detection algorithms”. Worst case scenario, we can just be very aggressive about what depends on what and it’s still better than rejecting entire features that are needed by thousands of authors daily on the grounds of “but if used nonsensically it could result in a cycle and then the world would explode!!!11”.
Potential cycles come up all the time with any reasonable styling mechanism that supports the kinds of constraints needed by real designs.
There’s something utterly perverse in thinking it’s an acceptable compromise to throw more work on the shoulders of the thousands (if not millions) of authors to prevent the handful of implementors from doing extra work.
Lea Verou (1, 2)