W3C home > Mailing lists > Public > www-style@w3.org > January 2011

Re: [CSS21] WD 4.1.6, 4.2: parsing of blocks

From: Alan Gresley <alan@css-class.com>
Date: Sun, 09 Jan 2011 00:03:21 +1100
Message-ID: <4D286099.9020009@css-class.com>
To: Boris Zbarsky <bzbarsky@MIT.EDU>
CC: Peter Moulder <peter.moulder@monash.edu>, www-style@w3.org
On 8/01/2011 8:58 AM, Boris Zbarsky wrote:
> On 1/7/11 2:40 PM, Peter Moulder wrote:
>> The first paragraph of ยง4.1.6 claims that between the delimiting braces
>> of a block "there may be any tokens, except that [brackets must be
>> in nested matched pairs]".


It also mentions parentheses (( )) and braces ({ }) being in nested pairs.


>> This conflicts with the grammar, which says that a block can't
>> contain BAD_STRING, BAD_URI or BAD_COMMENT tokens (i.e. not just "any
>> tokens")


I believe this is referring to a single nested block (that are nested 
deepest).


> It's not clear to me how one would even get any of those three tokens,
> given the end-of-stylesheet rules (which are applied before the
> tokenizer runs as far as I can tell; that's the only way they make any
> sense at all). Am I missing something?


I don't know. What is 'end-of-stylesheet rules'?


[snip]
>> The following lines each contain a malformed statement, but it isn't
>> clear where the malformed statement ends


Is this not clear in 4.2 regarding malformed statements?

   | User agents must handle unexpected tokens encountered
   | while parsing a statement by reading until the end of
   | the statement, while observing the rules for matching
   | pairs of (), [], {}, "", and '', and correctly handling
   | escapes.


>> , and hence whether the
>> p{color:blue} is to apply or not:
>>
>> } p{color:blue}
>> }} p{color:blue}
>> }{} p{color:blue}
>
> Just reading the spec without trying to read stuff into it, seems to me
> that the last one of those should apply; the previous two will be syntax
> errors due to failures to parse a selector.
>
> For what it's worth, that's interoperably implemented in at least
> Presto, Gecko, and Webkit, so apparently there wasn't much of an
> understanding problem here at least on the part of implementors....


This may be true for the below malformed statement which shows the color 
as blue,

p {color: red; font-weight: bold }
p {background:yellow
} p {color: red }
}} p {color: green }
}{} p {color: blue; font-weight: bold }


{ } } } { } } { }


but in this malformed statement shows the color as red.

p {color: red; font-weight: bold }
p {background:yellow
}{ p {color: red }
{ p {color: green }
}{} p {color: blue; font-weight: bold }


{ { } { { } } { }


I can't see why this later one should not be blue.


>> Similar comments apply to the corresponding phrases "while parsing a
>> declaration" and "end of the declaration", i.e. it isn't clear what
>> those phrases mean.
>
> Agreed.


How is this not clear?

The end of a declaration may be either a "property value" or with 
multiple declarations a 'semicolon'. This is what is in 4.1.8.

The parsing of a declaration is set out in 4.2.



-- 
Alan http://css-class.com/

Armies Cannot Stop An Idea Whose Time Has Come. - Victor Hugo
Received on Saturday, 8 January 2011 13:03:54 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:35 GMT