Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

srcset Arrives in WebKit: Hardware-dependent HTML

DZone's Guide to

srcset Arrives in WebKit: Hardware-dependent HTML

· Web Dev Zone ·
Free Resource

Jumpstart your Angular applications with Indigo.Design, a unified platform for visual design, UX prototyping, code generation, and app development.

Last year I wrote at length about the proposition to include a standardized (or was it bastardized) solution for responsive images in HTML. Well, earlier this week, WebKit incorporated the srcset attribute, which it hopes will fix the retina/HD part of the equation. It's hard not to feel disappointed.

One of the toughest things about defining web standards is that we have to be backward-compatible. Most people assume this just means that new changes shouldn't break older code, but it's actually a little trickier than that. Being backward-compatible also means that any new additions will determine what we can (and can't) do with future code. If we add a half-assed solution now (and it is adopted widely), we're probably stuck with it for the next 10 years (if not longer). So it's of utmost importance to think twice before adding something to the spec.

In short, the problem of burdening HTML with responsive content images is that the solution simply doesn't belong there. Because different available options need to be hard-coded in the HTML for each image separately, this means a major set of HTML changes whenever a new form factor or resolution needs to be added. Every single image (including all content images uploaded in CMSs) needs to be updated to reflect this change, which just plain sucks. There's never been a link between HTML and hardware before and it would be best to keep it that way, as it opens a door that's best kept shut.

Even worse, the srcset attribute only takes care of resolution and screen size, and not the actual available size for the image, meaning we still haven't learned a thing from the media queries mistake we made before. The days when phone or tablet screen sizes matched the available space are already behind us, so I don't really get why we're still stuck with that paradigm.

Everything points at the fact that srcset is a quick fix for a tough problem we can't solve right away. The problem with quick fixes is that they tend to linger and that, five or ten years down the line, we'll find ourselves cursing at the people who thought it wise to include them. It's happened before and it'll happen again, it's just a shame when you see it happening and you can do very little about it. Let's hope other rendering engine developers will act wiser, but I doubt it.


Take a look at an Indigo.Design sample application to learn more about how apps are created with design to code software.

Topics:

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}