- From: Anton Prowse <prowse@moonhenge.net>
- Date: Tue, 31 Jan 2012 23:37:26 +0100
- To: "www-style@w3.org" <www-style@w3.org>
- CC: Peter Moulder <peter.moulder@monash.edu>
On Fri, 07 Jan 2011 20:19:59 +0000, Peter Moulder <peter.moulder@monash.edu> wrote: > For invalid at-keywords, it isn't clear what "the next block" is. Please bear with me as I try to understand your bug (Issue 254: http://wiki.csswg.org/spec/css2.1#issue-254) and the spec, for filing in the bug tracker! 4.1.6 (Blocks) says: # A block starts with a left curly brace ({) and ends with the # matching right curly brace (}). 4.1.5 (At-rules) says: # At-rules start with an at-keyword, an '@' character followed # immediately by an identifier (for example, '@import', '@page'). # # An at-rule consists of everything up to and including the next # semicolon (;) or the next block, whichever comes first. 4.2 (Rules for handling parsing errors) says: # * 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. [...] # # * At-rules with unknown at-keywords. # User agents must ignore an invalid at-keyword together with # everything following it, up to the end of the block that # contains the invalid at-keyword, or up to and including the next # semicolon (;), or up to and including the next block ({...}), # whichever comes first. [...] > Test case: > > @x --> { } > p { color: blue; } I believe that the first line consists of a malformed statement, due to the "-->" not being legal in that position. In this case, I seem to recall a post (by David Baron or Bert Bos?) describing how the error parsing rules need to be applied in the order that they are given in 4.2. That is, the rule for handling malformed statements would be applied before the rule for unknown at-keywords. According to 4.1.5, the statement in your example consists of everything on the line; hence the line is ignored. The fact that the at-keyword is unknown doesn't come into play at all. > Other test cases would be to modify the @three-dee example by inserting > some extra rulesets after the h1 ruleset; by the "next ... block, > whichever comes first" rule I'd have expected these extra rulesets to > be honoured, but the "up to, and including, the third brace" text > suggests they won't be honoured. In the following: @three-dee { @background-lighting { azimuth: 30deg; elevation: 190deg; } h1 { color: red } h1 { color: black } } h1 { color: blue } h1 { color: white } both the at-rule statements are well-formed, but both involve unknown at-keywords. The "next block" after the @three-dee at-keyword is the one which contains the other at-rule and the red/black h1 rulesets, so according to the rule for unknown at-keywords the entire (outer) at-rule is actually ignored. The blue/white h1 rulesets are then honoured. So I'm not seeing why you would expect the black h1 ruleset to be honoured. Cheers, Anton Prowse http://dev.moonhenge.net
Received on Tuesday, 31 January 2012 22:37:55 UTC