- From: Bert Bos <bert@w3.org>
- Date: Mon, 28 Jan 2008 18:57:33 +0100
- To: "www-style@w3.org" <www-style@w3.org>
On Sunday 27 January 2008 01:42, L. David Baron wrote: > On Saturday 2008-01-26 14:59 -0800, Justin Rogers wrote: > > "Any @import rules must precede all other rules (except the > > @charset rule, if present)." > > > > Well that is clear. NO other rules are allowed, but what about > > failed rules? Rules that don't make sense: > > I've always assumed that unknown or invalid rules don't count for > this. I think that's probably the most useful behavior for > forward-compatibility. > > I think it's also reasonably clear in the spec, which says the > following (note "valid"): > # 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. > -- http://www.w3.org/TR/2007/CR-CSS21-20070719/syndata.html#at-rules I agree. I think what the spec is trying to say is that there are no features in CSS level *2* that can come before an @import, but it says nothing about future extensions. Things that don't affect the cascading rules could in the future be added before the @import. Maybe we'll add an @copyright rule some day... (I think not, but for argument's sake.) The error handling rules of section 4.2 apply to such potential future extensions. Thus, @charset "utf-8" foo bar baz; @charset "utf-8" foo bar baz; @import url(a.css); @import url(b.css) foo bar; @import url(c.css); is equivalent to <empty line> <empty line> @import url(a.css); <empty line> @import url(c.css); Because the first two @-rules are invalid. (Note that 'foo bar' is a valid media type, although currently unknown, and thus ignored.) And Justin's full example @charset "utf-8" foo bar baz; @charset "utf-8" foo bar baz; @page { } @media { } @import url(a.css); @import url(b.css) foo bar; @import url(c.css); reduces to <empty line> <empty line> @page { } @media { } <empty line> <empty line> <empty line> because the first two @-rules are invalid and the last three @import rules are ignored. (There is a separate discussion about whether '@media' is valid without any keywords. Anyway, the '@page' rule certainly is valid.) > > I think it's also what Ian tests in test 61c in > http://hixie.ch/tests/evil/css/import/extra/importafterimport.html > which is part of http://hixie.ch/tests/evil/css/import/ . 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 Monday, 28 January 2008 17:57:47 UTC