{"id":218,"date":"2012-05-14T12:35:37","date_gmt":"2012-05-14T12:35:37","guid":{"rendered":"http:\/\/www.w3.org\/community\/respimg\/?p=218"},"modified":"2012-05-16T21:13:15","modified_gmt":"2012-05-16T21:13:15","slug":"more-on-the-srcset-proposal","status":"publish","type":"post","link":"https:\/\/www.w3.org\/community\/respimg\/2012\/05\/14\/more-on-the-srcset-proposal\/","title":{"rendered":"More on the srcset proposal"},"content":{"rendered":"<p>After a lot of reading over the weekend and a fair bit of discussion on the WHATWG mailing list, \u00a0I&#8217;ve come to a couple of conclusions:<\/p>\n<ol>\n<li>Initially, I totally misunderstood how <code>&lt;img srcset&gt;<\/code> works<\/li>\n<li>I still don&#8217;t want it, and still <em>do<\/em> want <code>&lt;picture&gt;<\/code><\/li>\n<\/ol>\n<p>The appeal of <code>&lt;picture&gt;<\/code> is that you can select different image sources based on any media query, giving you fine control over which version is served under various conditions. Currently this includes viewport width\/height, device orientation, pixel density, colour capability etc, and as more media queries arrive (surely there will be a connection speed query sooner or later, and I&#8217;d love to see containing element width\/height as well) the element becomes even more useful and flexible. Initially, I thought <code>&lt;img srcset&gt;<\/code> was an attempt to avoid creating a new element by shoehorning this functionality into a new attribute.<\/p>\n<p><del>In fact, <code>&lt;img srcset&gt;<\/code> comes from a radically different angle. For each version of the image, we add an entry to the <code>srcset<\/code> attribute with the filename, and optionally the width, height and resolution (expressed as &#8220;1x&#8221;, &#8220;2x&#8221; etc). The <em>user agent<\/em> then decides which version to serve, based on the metadata we&#8217;ve given it and the current conditions on the client (viewport, connection speed, pixel density, user settings, etc). Unlike <code>&lt;picture&gt;<\/code>, authors aren&#8217;t specifying which source to use and when; rather, we&#8217;re just telling the user agent what&#8217;s available and letting it make the call on its own. <code>&lt;img srcset&gt;<\/code> allows authors to provide lots of different versions of an image, but affords us no control over when they are used.<\/del><\/p>\n<p><strong>Update:<\/strong>\u00a0I had this wrong, and so did quite a few other people. There&#8217;s still some ambiguity, with the spec contradicting itself in places. Jeremy Keith has done an excellent job of clearing up what the parameters in srcset actually do in <a href=\"http:\/\/adactio.com\/journal\/5474\/\" target=\"_blank\" rel=\"nofollow\">his post<\/a> today.<\/p>\n<p>When we practise responsive design, we are trying to give the best possible experience to our users by adapting our websites to work with whatever they are using to access them. <code>&lt;picture&gt;<\/code>, by design, gives us the control to do this with content images. <del><code>&lt;img srcset&gt;<\/code>, by design, takes it away.<\/del><\/p>\n<p>Of course, <code>&lt;picture&gt;<\/code> is imperfect (duplication of <code>alt<\/code> attributes is annoying, as is the potential duplication of media queries on some pages), but in my view it&#8217;s the best path to continue down.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>After a lot of reading over the weekend and a fair bit of discussion on the WHATWG mailing list, \u00a0I&#8217;ve come to a couple of conclusions: Initially, I totally misunderstood how &lt;img srcset&gt; works I still don&#8217;t want it, and &hellip; <a href=\"https:\/\/www.w3.org\/community\/respimg\/2012\/05\/14\/more-on-the-srcset-proposal\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1315,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_s2mail":"yes","footnotes":""},"categories":[1],"tags":[],"class_list":["post-218","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/www.w3.org\/community\/respimg\/wp-json\/wp\/v2\/posts\/218","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.w3.org\/community\/respimg\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.w3.org\/community\/respimg\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.w3.org\/community\/respimg\/wp-json\/wp\/v2\/users\/1315"}],"replies":[{"embeddable":true,"href":"https:\/\/www.w3.org\/community\/respimg\/wp-json\/wp\/v2\/comments?post=218"}],"version-history":[{"count":13,"href":"https:\/\/www.w3.org\/community\/respimg\/wp-json\/wp\/v2\/posts\/218\/revisions"}],"predecessor-version":[{"id":237,"href":"https:\/\/www.w3.org\/community\/respimg\/wp-json\/wp\/v2\/posts\/218\/revisions\/237"}],"wp:attachment":[{"href":"https:\/\/www.w3.org\/community\/respimg\/wp-json\/wp\/v2\/media?parent=218"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.w3.org\/community\/respimg\/wp-json\/wp\/v2\/categories?post=218"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.w3.org\/community\/respimg\/wp-json\/wp\/v2\/tags?post=218"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}