Re: Media Queries and optimizing what data gets transferred

Am 28.01.2013 14:40 schrieb Henri Sivonen:
> On Fri, Jan 25, 2013 at 8:28 PM, Tab Atkins Jr. <jackalmage@gmail.com> wrote:
>> As Boris has explained, it's not performance issues, but rather author
>> expectations.  The average author expects a CSSOM to exist for all the
>> stylesheets in the page, and when the set of matched MQs changes, for
>> the styles to change at the same time, not a network-roundtrip later.
>
> Does the average author really expect anything about CSSOM? I would
> guess that the average author doesn't use CSSOM beyond the sugaring
> for the style attribute and maybe getComputedStyle() and even those
> hidden behind a JavaScript library.
>
> The use cases for fiddling with the style rules of external sheets in
> the OM (beyond the immediate style attribute sugaring) don't seem that
> common.
>
> To me, optimizing the availability of inapplicable style sheet data in
> the OM over what gets transferred seems totally backwards compared to
> what the mythical average author wants.

I don't know whether I am average, but I am an author with very limited 
background knowledge about networking and only user knowledge about CSS. 
For the case it could help the discussion, let me say shortly what my 
expectations are (resp. were, before I read this thread):

- I'd expect stylesheets that don't match the actual media query not to 
be loaded. (Else, why not just use separate @media blocks instead of 
separate stylesheet files?) The same applies for unnecessary background 
images, and, once "responsive images" will be implemented, also for 
content images. User actions such as viewport resizing, zooming or 
changing the font size look like special cases to me, where a small 
delay to load resources is acceptable (people who always want e.g. big 
fonts will have set this in their user prefs, rather than hitting ctrl-+ 
whenever they open a web page).

- A special case is media print. I'd expect a decent UA to start loading 
the resources for printing in the background after having loaded the 
resources for the actual page rendering process.

- Regarding script access, I was not aware of the possibility to use 
scripting on individual stylesheets; I assumed that scripting always 
applies to the actual state of a page. (This awareness may change once 
the CSSOM will be widely known.) I'd be prepared to encounter errors 
when performing script actions on elements that may not be available, if 
an other media query applies.

HTH,
Markus

Received on Monday, 28 January 2013 16:13:13 UTC