Add type() descriptor to srcset #210

Open
zcorpan opened this Issue Jun 9, 2014 · 3 comments

Projects

None yet

2 participants

@zcorpan
zcorpan commented Jun 9, 2014

@tabatkins sayeth thus

I'd like to allow individual sources to specify a type as well with a ''type()'' function,
overriding the default type specified by the type attribute,
but I'm keeping things simple for now.

@zcorpan
zcorpan commented Jun 9, 2014

So instead of

<picture>
  <source type="image/webp" srcset="dogs-1.webp, dogs-2.webp 2x">
  <source type="image/vnd.ms-photo" srcset="dogs-1.jxr, dogs-2.jxr 2x">
  <img src="dogs-1.jpg" srcset="dogs-2.jpg 2x"
       alt="Hundreds of hot dogs" width="600" height="200">
</picture>

You want to do this:

<img src="dogs-1.jpg" srcset="dogs-1.webp type(image/webp), dogs-2.webp 2x type(image/webp),
     dogs-1.jxr type(image/vnd.ms-photo), dogs-2.jxr 2x type(image/vnd.ms-photo),
     dogs-2.jpg 2x"
     alt="Hundreds of hot dogs" width="600" height="200">

?

@eeeps
eeeps commented Jun 9, 2014

First type match wins, or is there a browser-specific preferred, ordered list of handle-able types, or...?

@eeeps
eeeps commented Jun 9, 2014

Given the "browser decides" nature of srcset, I'd be 100% behind the browser picking the type to use... if you, the author want to impose your own agenda, use picture & source type.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment