Re: [CSS 2.1] @charset, @import, and error recovery

L. David Baron wrote:
 > Compare the following:
 > In Firefox, the first two are green, since @page is not supported or
 > parsed.  But the third is black and underlined.  The same is true of
 > IE7.  This means the ignored @page and @pagg rules are not used to
 > determine whether to ignore the @import, but the used @media rule is.
 > In Opera 9.26, the one with @page is black (@import ignored), but the
 > one with @pagg is green (@import used).  This makes sense since @page is
 > supported in Opera.
 > In Safari 3.0.4, all three are black (so there is some inconsistency).
 > I don't think any clarification to the spec is strictly needed, since
 > says:
 >   # CSS 2.1 user agents must ignore any '@import' rule that occurs
 >   # inside a block or after any valid statement other than an @charset
 >   # or an @import rule.
 > Note the "any *valid* statement".  This requirement is a conformance
 > requirement on user agents.

That requirement directly provokes the hackish behavior. Having that, author 
may conditionally import stylesheet depending on UA capabilities:

   @page { @top-left { } }
   @import url(browsers-without-css3-page-support.css)

   @page {}
   @import url(browsers-without-css21-page-support.css)

The same hacks could be applied to other rules. Was that the intent?

Andrei Polushin

Received on Sunday, 9 March 2008 19:37:28 UTC