Re: [css-images] image() function with conditions

On Mon, Sep 2, 2013 at 12:58 AM, Dirk Schulze <dschulze@adobe.com> wrote:
> I thought about combining both. It seems more complicated to have two image functions that have the same syntax but different virtual purposes. Why not combine both if that is possible. With the current syntax as specified you would need to do:
>
> image-set(image('image-highDPI.png.webp', 'image-highDPI.png.png') 2dppx, image('image-lowDPI.png.webp', 'image-lowDPI.png.png') 1dppx);
>
> and the implementation that does not implement WebP still needs to download at least two images. So why not combine both into one function from the beginning?

Syntax suggestions welcome - the WG didn't want to mix semantics
invisibly, where *sometimes* images were fetched and tested in a
linear fashion, and *other times* they were fetched in an
implementation-dependent order.  On the other hand, we couldn't come
up with a non-horrible syntax for mixing them *visibly*.  So we're
currently stuck with the semi-horrible mixed format you see there.

I'm not sure what you mean by "needs to download at least two images".
 Once I add the type() filter to image() (which I'll do as soon as I
start actually working on Images again), the UA would only have to
download the one image it understands from the resolution it chooses.

> And when we are at it: It is not nice for authors that it is '1x', '2x' and so on on the HTML element as described in [1] but something like dppx on CSS [2]. The HTML and CSS WG should work together and come up with a unified way.

Note that there's an issue in the spec about adding "x" as another
resolution unit, defined to have the same meaning as "dppx".  I agree
that having a gratuitous difference like that between the two syntaxes
would be annoying.

~TJ

Received on Monday, 2 September 2013 08:10:24 UTC