[whatwg] Problems with width/height descriptors in srcset

Simon Pieters simonp at opera.com
Wed May 16 05:13:59 PDT 2012


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.

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.

Even the spec seems confused about min-width vs max-width:

"The attribute essentially takes a comma-separated list of URLs each with  
one or more descriptors giving the maximum viewport dimensions and pixel  
density allowed to use the image."

Later:

"If there are any entries in candidates that have an associated width that  
is greater than max width, then remove them,"

The first quote should say "minimum viewport dimensions" to match the  
algorithm. Or vice versa, if the algorithm is wrong.

-- 
Simon Pieters
Opera Software


More information about the whatwg mailing list