By Mat Marquis CHAPTER 5
for all with a bit of clever JavaScript. So, we began hashing out ideas for a
native solution: if HTML5 offered us a way of solving this, what would it
look like?
Bruce Lawson originally proposed a markup pattern^19 for delivering
context-appropriate images that fell in line with the syntax for the video
and source elements:
Around the same time as we presented this pattern to the WHATWG,
they pitched their own idea^20 for a markup-based means of serving
context-appropriate image sources: the srcset attribute.
While the srcset attribute’s syntax was nearly inscrutable, it did
handle one part of the equation in an especially efficient way: resolution
switching, using values of 1x, 2x, and so on. Furthermore, it handled the
question of resolution outside of media queries, which we soon realized
stood to benefit users even further.
Media queries are an absolute, at least on paper. It’s hard to imagine
a circumstance where a user might want to opt into a layout not suited
for their display. Likewise, it takes a lot of imagination to come up with
a scenario in which a user would prefer images too small or too large