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

Proposed text CSS 2.1 issue 71

From: Bert Bos <bert@w3.org>
Date: Tue, 13 Jan 2009 21:24:37 +0100
To: W3C style mailing list <www-style@w3.org>
Message-Id: <200901132124.37790.bert@w3.org>

Here is some proposed text to solve issue 71 
(http://wiki.csswg.org/spec/css2.1#issue-71), which says:

    Resolution
        @rules inside declaration blocks are ignored if between
        declarations (i.e. at the beginning of a declaration before the
        property), invalid if within declarations.

(I think it would really be much cleaner to leave 2.1 alone and put the 
margin boxes *outside* the @page rule in css3-page... See the thread at 
http://lists.w3.org/Archives/Public/www-style/2008Jul/0070.html for 
some context for this issue.)


Add the following at the end of 4.1.6 
(http://www.w3.org/Style/Group/css2-src/syndata.html#block)

------------------------------------------------------------------------
Three special kinds of blocks are defined and they have additional 
parsing rules: "declaration block" (defined in 4.1.7 below), "block of 
statements" and "block of declarations and at-rules." (Future versions 
of CSS may define additional kinds.)

E.g., in CSS 2.1, '@page'[ref 13.2] is followed by a block of 
declarations and at-rules, '@media'[ref 7.2.1] by a block of 
statements, and a selector by a block of declarations.

The syntax of a block of statements is

    '{' [ S | statement ]* '}' S*;

where the part between the curly braces is considered as a style sheet 
for the purpose of handling parsing errors (except that the CDO and CDC 
tokens cannot occur).

The syntax of a block of declarations and at-rules is

    '{' S* [ declaration | at-rule | ';' ]* '}' S*;

with as additional rule that any sequence consisting of one or more 
at-rules and ending with a declaration (i.e.: "at-rule+ declaration" 
with no intervening ';') must be ignored[ref].

Note: The reason for this rule is that the '@page'[ref 13.2] rule in 
previous versions of this specification was defined as having a block 
of declarations, rather than a block of declarations and at-rules, and 
corresponding implementations therefore ignore invalid tokens inside 
@page up to the end of the declaration. (The changed definition of 
@page is necessary, because CSS level 3 is expected to define at-rules 
for use inside @page.)

Example: The last three lines in the following @page rule are ignored

    @page {
        margin: 3cm;
        @bottom { color: blue } ;
        @left { color: yellow }
        @top { color: red }
        margin: 4cm;
    }

making the rule equivalent to

    @page {
        margin: 3cm;
        @bottom { color: blue } ;
        ;
    }

(In CSS 2.1, @bottom is not defined, and thus that line is also ignored, 
according to the rule for "invalid at-keyword" in section 4.2, leaving 
just '@page {margin: 3em;;;}')

Note: An expression such as 'color: red @left;' is not a declaration 
followed by an at-rule, but a single declaration, which happens to have 
an at-keyword as part of its value. If the 'color' property does not 
allow such a value (as is the case in CSS 2.1), the whole declaration 
is ignored, not just the unknown keyword.
------------------------------------------------------------------------

In 13.2 (http://www.w3.org/Style/Group/css2-src/page.html#page-box) 
replace

    followed by a block of declarations
by
    followed by a block of declarations and at-rules[ref 4.1.6]




Bert
-- 
  Bert Bos                                ( W 3 C ) http://www.w3.org/
  http://www.w3.org/people/bos                               W3C/ERCIM
  bert@w3.org                             2004 Rt des Lucioles / BP 93
  +33 (0)4 92 38 76 92            06902 Sophia Antipolis Cedex, France
Received on Tuesday, 13 January 2009 20:25:16 GMT

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