[whatwg] Problems with width/height descriptors in srcset

Simon Pieters simonp at opera.com
Mon May 21 21:45:41 PDT 2012


On Mon, 21 May 2012 19:09:24 +0200, Jeremy Keith <jeremy at adactio.com>  
wrote:

> Simon asked:
>>> It also lets us add "max-width", though that may complicate
>>> the resource choosing algorithm a bit.
>>>
>>> ~TJ
>>
>> Does doing so solve any use cases?
>
> Yes, absolutely. I can go through it all again, but basically having  
> both a min-width/height and a max-width/height option gives the  
> developers the choice of either building in a "Mobile First" or Desktop  
> First" way.
>
> i.e.
>
> either:
> Use a small image by default in src and list larger and larger images in  
> srcset
> or:
> Use a large image by default in src and list smaller and smaller images  
> in srcset.
>
> If you want specific examples of responsive sites currently using one or  
> other of these techniques, I'll be able to find them for you.

I agree that that is a use case that should be solved, but I don't see how  
having both min- and max- solves that. The email you just replied to had a  
proposal to address that use case, though:

On Mon, 21 May 2012 08:28:56 +0200, Simon Pieters <simonp at opera.com> wrote:

>> Also, since the fallback image participats as a candidate, but you  
>> cannot change its descriptors, you are not free to use any of the  
>> images as the fallback image. You might either want the narrowest image  
>> to be the fallback, or the widest image, or one in between, but the  
>> syntax doesn't allow choice, AFAICT.
>
> To solve this problem, I propose that we allow the src URL to be  
> specified in srcset, and when it is, don't add src as a candidate. It  
> would be good with a keyword "inf" or "infinity" as a width descriptor  
> in this case so you don't need to specify "1x" when you want infinity.

(This even allows using one of the "in between" images as the fallback.)

-- 
Simon Pieters
Opera Software



More information about the whatwg mailing list