[whatwg] Implementation complexity with elements vs an attribute (responsive images)
mjs at apple.com
Sun May 13 18:40:08 PDT 2012
On May 12, 2012, at 5:33 PM, Mathew Marquis <mat at matmarquis.com> wrote:
> I worry that, when faced with this markup, developers will simply opt to serve the largest possible image in a src. In fairness, that approach "works" with far less headache.
For the resolution-adaptation use case, that wouldn't do the right thing by itself because it wouldn't downscale. <img src="foo.jpg" srcset="foo-highres.jpg 2x"> is the minimum you need to get proper fallback. When/if all browsers support srcset (assuming it is even selected), you could omit the src containing the 1x image and this would be a perfectly valid choice. The key issue here, and a big difference from the <picture> approach, is that to actually get higher resolution on a high-rez display, you need to rescale the image to below its normal intrinsic size. You can do this by explicitly styling it to a fixed size, by using an explicit image resolution, or through the 2x shorthand as above. But for compatibility reasons it can't just happen automatically or images meant to be viewed at 1x will be too small.
More information about the whatwg