Skip to content

Commit

Permalink
[css-nesting-1][editorial] Add a note recommending against mixing pro…
Browse files Browse the repository at this point in the history
…perties and nested rules willy-nilly. #8349.
  • Loading branch information
tabatkins committed Jan 26, 2023
1 parent 64d3416 commit 4c9c0b6
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions css-nesting-1/Overview.bs
Original file line number Diff line number Diff line change
Expand Up @@ -873,6 +873,15 @@ Mixing Nesting Rules and Declarations {#mixing}
before "Order Of Appearance" comes into consideration.
</div>

Note: While one <em>can</em> freely intermix declarations and nested rules,
it's harder to read and somewhat confusing to do so,
since all the properties <em>act as if</em> they came before all the rules.
For readability's sake,
it's recommended that authors put all their properties first in a style rule,
before any nested rules.
(This also happens to act slightly better in older user agents,
due to specifics of how parsing and error-recovery work.)


<!--
████
Expand Down

5 comments on commit 4c9c0b6

@plinss
Copy link
Member

@plinss plinss commented on 4c9c0b6 Jan 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of just mentioning error recovery, IMO it would be better to explain what will happen, e.g. the next declaration will be skipped, even if otherwise valid.

@tabatkins
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I usually try to avoid getting into details about parsing unless absolutely necessary. If authors follow the advice they never need to know what the effects of not following it are; if they don't follow it they'll find out what the effects are pretty quick anyway. ^_^

@plinss
Copy link
Member

@plinss plinss commented on 4c9c0b6 Jan 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Understood, and I'm not suggesting regurgitating all the error recovery behavior here (tho maybe a link would be useful), but at least mentioning that 'some content may be skipped' or something vague will still be useful to set expectations and help reinforce the 'proper way'.

@tabatkins
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair, done.

@plinss
Copy link
Member

@plinss plinss commented on 4c9c0b6 Jan 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks

Please sign in to comment.