- From: Andrew Fedoniouk <news@terrainformatica.com>
- Date: Mon, 09 Jun 2008 11:08:26 -0700
- To: Andrew Fedoniouk <news@terrainformatica.com>, Anne van Kesteren <annevk@opera.com>, www-style@w3.org
L. David Baron wrote: > On Monday 2008-06-09 09:20 -0700, Andrew Fedoniouk wrote: > >> MQs are intended to be used in @media and @import statements. >> Currently these statements are parse time constructions as >> clearly stated in CSS 2.1 spec. >> > > Where in CSS 2.1 does it say that the contents of @media or @import > with non-matching media lists are ignored at parse time? If it > does say that, it's a bug in the spec. > > It's certainly not how we've ever implemented them. We don't need > to reload style sheets when we print. > <quote src="http://www.w3.org/TR/CSS21/cascade.html#at-import"> 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 types after the URI." </quote> That clearly tells me that I can avoid retrieving resources as a whole if at parse time I've discovered that media type does not match. If rules from unsupported media types in @media sections are getting into the runtime style table then such rules (selectors in particular) shall have specificity rules defined with respect of the @media. I do not know how you have implemented @media parsing currently but these two sets: @media screen { p{...} } @media print { p{...} } will create rules with the same value of specificity (they will be different only by order of selectors in the source). If to speak about MQs that are parsed into runtime sets then I would like to know also exact specificity rules for selectors inside these two sections: @media min-device-width:800 and max-device-width:1024 { p{...} } @media device-width: 1000 { p{...} } What weight have these two 'p' selectors? Are they different only by the order of rules in the source or by power of the @media expression too? If only by the order then how UA shall react on the event when say device resolution is changed in runtime? Imagine that condition in some @import device-width: 1000 "only-for-1000.css" will suddenly become true or false. What should be done in this case? Shall UA go and retrieve "only-for-1000.css" style sheet? How then new selectors will change current set of rules that are already there? Shall they be appended, inserted or what? I mean if @media works as a selector than it has to affect specificity calculation rules. So either MQ specification or CSS3-selectors have to be updated with info of how to do this. Currently @media or @import constructions behave as pure parse time / preprocessor alike constructions similar to #ifdef #endif in C/C++. At least nothing in the spec tells that @media or @import have to affect set of rules in runtime. -- Andrew Fedoniouk. http://terrainformatica.com
Received on Monday, 9 June 2008 18:09:17 UTC