[whatwg] Problems with width/height descriptors in srcset

Simon Pieters simonp at opera.com
Sun May 20 23:28:56 PDT 2012


On Wed, 16 May 2012 18:25:58 +0200, Tab Atkins Jr. <jackalmage at gmail.com>  
wrote:

> On Wed, May 16, 2012 at 5:13 AM, Simon Pieters <simonp at opera.com> wrote:
>> The width/height descriptors in srcset seem to be difficult for people  
>> to
>> get right, even people who read the spec.
>>
>> * It's not clear from the syntax that it refers to the viewport size  
>> rather
>> than the image size.
>> * It's not clear if it's min-width or max-width.
>
> Absolutely agreed.  Like several others have suggested, I think we
> should just go with a "min-width:100px" approach, which is much
> clearer.

Though that still doesn't make it clear that it refers to the viewport  
size rather than the image size. Or does it?


>  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?


On Wed, 16 May 2012 14:13:59 +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.

-- 
Simon Pieters
Opera Software



More information about the whatwg mailing list