<picture>
<srcset media="(min-width: 40em)">
<source size="1x" src="big.jpg" />
<source size="2x" src="big-hd.jpg" />
</srcset>
...another srcset...
<img src="fallback.jpg" />
</picture>
Fractionally more verbose, but really a lot less fiddly.I guess that it should be possible though for browser to parse a html fragment rooted on the picture tag, and then plug that tree back later on in the full document tree when it is constructed. Or is it simpler to search for picture/img attributes? Oh, there's this whole implicit tag closing business in html though...How do we know where to stop parsing a fragment? At least attributes values stops at the end of a string literal, or on a tag end. Perhaps that's the reason why they went for a dsl in attributes.
I agree with you though, it's cleaner your way, and perhaps xhtml could use that approach in the future?
I really wish it was - though I'm far from a fan of XML for most cases, it does work rather well for this when used as intended...
Hixie was against using elements, as it's harder to spec (attribute change is atomic). Eventually <picture> got a simplified algorithm that avoids tricky cases of elements, but at that point srcset was a done deal.
At least we've got separate media, sizes and srcset instead of one massive "micro"syntax.