- From: Ian Hickson <ian@hixie.ch>
- Date: Sat, 4 Sep 2004 11:24:51 +0000 (UTC)
- To: Christian Roth <roth@visualclick.de>
- Cc: www-style Mailing List <www-style@w3.org>
On Fri, 3 Sep 2004, Christian Roth wrote:
>
> Assuming the following stylesheet:
>
> @import "include.css" { color: red } print;
> .red { color: red; }
>
> 1) Should it include "include.css"?
No.
> 2) Should it include "include.css" only for the print media type?
No.
> 3) Should the @import rule be ignored completely?
Yes.
> 4) Should elements of class "red" have red text?
No.
> 1: MAYBE: The rule is neither unrecognized nor misplaced [1], so it may
> not be ignored. However, it cannot be parsed further starting with the
> open curly brace, so its remainder is ignored up to the ending semicolon,
> leaving us with
> @import "include.css"
> plus the again recognized ';' since we know an @import rule ends with a
> semicolon.
The rule uses invalid syntax and thus must be ignored.
The rule consists of exactly:
@import "include.css" { color: red }
...no more, no less. That's not valid.
> 2: MAYBE: Same reasoning like in (1), but { ... } is not allowed in
> @import. However, @import ends with a semicolon, so we skip the unknown
> part between braces and pick up again after it, giving us a print media type.
You can't combine different parts of the stylesheet after ignoring parts.
> 3: MAYBE: It is neither unrecognized nor misplaced (-> NO), except for
> when "unrecognized" means "either unknown name or not valid according to
> the grammar" (-> YES). [1]
I agree that the spec should be clearer.
> 4: MAYBE: According to the rules for forming at-rules [1], the @import
> rule ends after the closing brace. The remaining stylesheet is
> print; ...
> whereby this is no longer parseable according to the grammar, and
> therefore [1] applies, whereby we take the largest chunk of the
> stylesheet to be parsed from the beginning, discarding the rest from the
> place where we can no longer parse. This means the stylesheet would end
> after the closing brace in @import.
My interpretation is that the sheet consists of:
1. An invalid @rule: @import "include.css" { color: red }
2. An invalid rule: print; .red { color: red; }
Both are dropped.
--
Ian Hickson U+1047E )\._.,--....,'``. fL
http://ln.hixie.ch/ U+263A /, _.. \ _\ ;`._ ,.
Things that are impossible just take longer. `._.-(,_..'--(,_..'`-.;.'
Received on Saturday, 4 September 2004 11:24:53 UTC