Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

My memory was correct. I found the section in the original proposal[1] that did not allow mixing nested rules and declarations:

> When a style rule contains both declarations and nested style rules or nested conditional group rules, the declarations must come first, followed by the nested rules. Declarations occuring[sic] after a nested rule are invalid and ignored.

[1] https://www.w3.org/TR/2021/WD-css-nesting-1-20210831/#mixing

Fortunately, this has been changed in the most recent proposal[2]:

> When a style rule contains both declarations and nested style rules or nested conditional group rules, all three can be arbitrarily mixed. However, the relative order of declarations vs other rules is not preserved in any way.

[2] https://www.w3.org/TR/css-nesting-1/#mixing



Very interesting and exactly what I was curious about! Thanks for the links

Really curious about the reasoning behind that initial quirk


Depending on the exact parsing strategy it might be genuinely required (such as if the parser switches from "property mode" to "rule mode" at some point), but in this case it was just because it's kinda confusing to do so.

We removed the restriction, but still warn against it due to readability issues.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: