Re: [css-syntax] string to number feedback

Le 20/07/2013 17:46, Marc O'Morain a écrit :
> On Sat, Jul 20, 2013 at 4:15 PM, Marc O'Morain <marc@marcomorain.com> wrote:
>> Hi guys,
>>
>> I have another question – section "5.4.3 Consume a qualified rule"
>> doesn't match the railroad diagram for "Qualified rule" in section
>> 5.1.
>>
>> 5.4.3 says that a qualified rule contains a simple block (incorrect I
>> think?), whereas the railroad diagram says it contains a declaration
>> list (correct I think?).

Good catch, fixed.

We forgot to updated the diagrams when we changed the spec recently so 
that qualified rules contain not just declarations but any {} block.

Even though qualified rules that currently exist in CSS (namely: style 
rules and keyframe rules inside @keyframes) all contain declarations, 
this might not be the case in the future. The idea is that a qualified 
rule’s block content can be parsed with "Parse a list of declarations", 
or some other algorithm depending on how this particular rule is defined.


> Following on from my own post, I think the railroad diagram for
> "Qualified rule" is incorrect.
>
> The file at https://gist.github.com/marcomorain/6045647 is not valid
> CSS (it has no selector). I have verified this with the tool on
> http://jigsaw.w3.org/css-validator/
>
>> {
>>    width: 100%;
>> }
>
> This input would be accepted by the railroad diagrams (stylesheet =>
> qualified rule => declaration list, bypassing the 'component value' in
> the 'qualified rule' diagram). There should not be a route around the
> 'component value' in 'qualified rule'.

Yes this is an invalid style rule, but as far as the Syntax module is 
concerned it is a valid qualified rule whose prelude happens to be an 
invalid (empty) selector, just like this one:

div:has-magic(42bz) {
     width: 100%;
}

We could make such rules invalid at the Syntax level, but either way 
works so meh.

We have this distinction between qualified rules and style rules for 
separation of concerns: Syntax does not need to know about Selectors or 
the various CSS at-rules.

Also, as Zack said, invalid rules still need to be parsed in order to 
know where to recover and start parsing subsequent rules.

-- 
Simon Sapin

Received on Saturday, 20 July 2013 17:14:09 UTC