RE: Problem with @page within @media

:The other thing is that the DOM is quite capable of containing 
:page rules within media rules.

That doesn't make it legal CSS. That's a limitation of inheritance in OO
languages. A DOM implementation is expected to handle such exceptional type
exclusions.

:So, is it valid to have a @page within a @media or not? 

The answer is no. I posted about this a while back. There is an example of
such a nesting in the CSS2 recc:

@media print {
  @page         { margin: 10% }
  H1, H2, H3,
  H4, H5, H6    { page-break-after: avoid; page-break-inside: avoid }
  PRE           { page-break-inside: avoid }
  UL, OL, DL    { page-break-before: avoid }
}

As youi know, this is not legal CSS2 as defined by the grammar productions.
I expect that the grammar will be updated for CSS3 to make such nesting
legal. I am not aware if browsers support it regardless.


:Oh, and another thing, in the forward-compatible parsing rules 
:in section
:4.1.1 it specifies a DELIM as 'any other character',  does 
:this mean that an
:'any' segment may consist of a single character of any type or 
:does it mean
:that no one knew what the DELIM should be when the spec was 
:written ?  The
:DELIM needs to at least be a ',' I think otherwise a selector 
:cannot contain
:a comma seperated list of items (ie. H1,H3,H4.blah { blah : blah } )  I
:think it should also include ':' for pseudo elements, but this 
:can effect
:what is also allowed in the 'value' segment and I'm not sure if that is
:valid.

Ideally the production for ruleset should be updated to replace the literal
',' with a delim token, but this makes the grammar ambiguous, if a delim can
be one of a number of different literals and it breaks the grammar in the
sense that it is no longer LL(1). The other option is  define specific
tokens for each case, which is inelegant. It's accepted practice to use
literals in such cases when defining a grammar.

On the subject of delims, the CSS2 recc is riddled with function examples
that use ',' as delimiters, but the use of ',' is not permitted in the
production for expr, which dictates the body of a function. Not serious
because it's not a big deal to adjust the grammar for expr in this case, but
it does mean there is a lot of illegal CSS out there...

Wrt to pseudo, the ':' literal is part of a pseudo not a delimiter for it,
in the same sense that '@' is part of an at rule. The same applies for class
and elem identifiers as well.

-Bill

Received on Wednesday, 1 March 2000 04:40:39 UTC