Re: [css-syntax] Drafted a new "CSS Stylesheet" section, please comment

Le 24/07/2013 19:27, Tab Atkins Jr. a écrit :
> On Tue, Jul 23, 2013 at 7:15 AM, Simon Sapin <simon.sapin@exyr.org> wrote:
>> Hi,
>>
>> The output of the parser described in css-syntax is made of generic
>> qualified rules, at-rules, and declarations where rule preludes, block
>> contents and declaration values can be almost anything.
>>
>> As requested during the Tokyo F2F, I started a new section on how to
>> interpret this output into a CSS stylesheet as represented in CSSOM,
>> expected by Cascade, etc.
>>
>> http://dev.w3.org/csswg/css-syntax/#css-stylesheets
>>
>> Comments?
>
> Thanks for drafting this!
>
> I think my last commit pretty much entirely rewrote it, but your base
> text was very useful for structuring it.

Thanks for the rewrite, it is clearer now.


  # To parse a CSS stylesheet, first parse a stylesheet.
  # Interpret all of the resulting top-level qualified rules
  # as style rules, defined below.

I feel that this paragraph should say something about top-level 
at-rules, but I don’t know how to word it. (This spec only defines 
@charset, but other specs define more at-rules.)


  # The prelude of the qualified rule is parsed as a selector list.
  # If the prelude does not successfully parse as a valid selector,
  # the entire style rule is invalid.

I changed this to use "invalid selector", which the Selectors spec 
defines precisely. A selector can conform to the grammar but be invalid, 
for example if it uses an undeclared namespace prefix.


Although you removed that link, I think that rule grammars really should 
refer to #rule-defs. Some details of how these grammars work are 
important but not always be obvious.

By the way, I added there that tokens written literally in grammars 
match ASCII case-insensitively unless defined otherwise.


> Do we need anything for the CSSOM hookup, or is that just handled
> implicitly by CSSOM itself, by virtue of it somehow applying itself to
> stylesheets?

IMO Syntax now has a sufficient definition of concepts like "CSS 
stylesheet" and "style rule" that CSSOM can refer to.

-- 
Simon Sapin

Received on Thursday, 25 July 2013 13:02:59 UTC