W3C home > Mailing lists > Public > www-style@w3.org > March 2008

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

From: Andrei Polushin <polushin@gmail.com>
Date: Mon, 10 Mar 2008 01:37:09 +0600
Message-ID: <47D43C65.6070902@gmail.com>
To: www-style@w3.org

L. David Baron wrote:
 > Compare the following:
 >   http://dbaron.org/css/test/2008/import-after-page
 >   http://dbaron.org/css/test/2008/import-after-pagg
 >   http://dbaron.org/css/test/2008/import-after-media
 >
 > 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
 > http://www.w3.org/TR/2007/CR-CSS21-20070719/syndata.html#at-rules 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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:55:02 GMT