w3c / csswg-drafts

CSS Working Group Editor Drafts
https://drafts.csswg.org/
Other
4.42k stars 648 forks source link

[cssom] [css-page] Define serialization of CSSPageRule #9953

Open mstensho opened 6 months ago

mstensho commented 6 months ago

https://drafts.csswg.org/cssom/#css-rules defines how various rule types are serialized, but the entry for CSSPageRule just says "Need to define how CSSPageRule is serialized.".

mstensho commented 6 months ago

What should come first - child margin rules, or the CSS property / descriptor declaration block (CSSStyleDeclaration)? I imagine that dumping the declaration block first is a slightly better choice. This may be how authors typically write it, as well, since the properties are inherited by the margin contexts, so that putting them first makes it more readable.

And is it fine to simply include the page-specific descriptors (size and page-orientation) in CSSStyleDeclaration, just as if they were regular properties in a way?

mstensho commented 6 months ago

The order that I suggested above (declarations, then child rules) also agrees with how CSSStyleRule is serialized.