Example <img srcset>
has size points of 300w, 600w, 1200w, 2400w. Mobile (both in devtools and actual chrome on android (moto g3)) ALWAYS use 1200w (even though the mobile window width is considerably smaller and should be using the 600w) -- I am aware of chrome's caching behaviour with larger images and all tests are were done with cache disabled.
Provided example code that displays the broken behaviour of <img srcset>
as well as an implementation using <picture>
that does EXACTLY what behaviour is expected from srcset.
https://codepen.io/MiDri/pen/OYmReg
<img src='/1x1.gif' srcset='https://dummyimage.com/300x200/0000ff/fff 300w, https://dummyimage.com/600x400/000/fff 600w, https://dummyimage.com/1200x800/ff0000/000 1200w, https://dummyimage.com/2400x1600/00ff00/000 2400w'>
<picture>
<source srcset='https://dummyimage.com/300x200/0000ff/fff' media='(max-width:300px)'>
<source srcset='https://dummyimage.com/600x400/000000/fff' media='(max-width:600px)'>
<source srcset='https://dummyimage.com/1200x800/ff0000/000' media='(max-width:1200px)'>
<source srcset='https://dummyimage.com/2400x1600/00ff00/000' media='(max-width:2400px)'>
<img src='/1x1.gif'>
</picture>
Does anyone know WHY srcset is behaving like this?