- From: L. David Baron <dbaron@dbaron.org>
- Date: Mon, 9 Jun 2008 15:34:54 -0700
- To: Andrew Fedoniouk <news@terrainformatica.com>
- Cc: Boris Zbarsky <bzbarsky@MIT.EDU>, Anne van Kesteren <annevk@opera.com>, www-style@w3.org
On Monday 2008-06-09 15:14 -0700, Andrew Fedoniouk wrote:
> @import url(a.css) min-device-width:800;
> and a.css contains:
> @media max-device-width:1200
> {
> p { color: red;}
> }
> will p get color red if your screen happens to be 640 pixel wide?
No. (I'm assuming the syntax is corrected to have the required
parentheses.)
> Specs (CSS 2.1 and CSS3) are not clear on the subject.
> They say (http://www.w3.org/TR/css3-cascade/#at-import) you "can" skip
> a.css loading.
> So you may load or you may not load that conditional import. So is
> ambiguity that I have.
>
> I think that wording should be as:
>
> "So that user agents can avoid retrieving resources for unsupported
> media types, authors may specify media-dependent @import rules. These
> conditional imports specify comma-separated “media queries” after the
> URI. *If user agent makes an attempt to retrieve the CSS resource then
> that UA shall behave as if all rules from that conditionally imported
> CSS sheet are enclosed in correspondent @media section.*
Ah, you're saying that nothing says that the rules in the imported
sheet are excluded if the media given don't match the device. (This
is in fact the case, although I agree the spec is very unclear.)
You don't want to define it in terms of syntactic equivalence; that
would trigger other rules in the spec that you don't want to trigger
(e.g., not allowing @import after @media).
However, I agree that it should be clearer that @media,
@import-with-media, <link>-with-media, <style>-with-media, etc. are
all adding restrictions, and for a rule to be applied, the device
has to match the medium restrictions of each link on a chain to that
rule. (Note that the rule might be reachable in multiple ways,
e.g., a style sheet could be imported twice with different media
lists; it only needs to be reachable through one chain.)
I thought we had a CSS 2.1 issue on that before, though. But I
suspect the only thing we clarified for that was the last paragraph
in 7.2.1.
-David
--
L. David Baron http://dbaron.org/
Mozilla Corporation http://www.mozilla.com/
Received on Monday, 9 June 2008 22:36:11 UTC