Many agree that the newly proposed srcset
attribute is much less syntactically intuitive than the widely appreciated picture
element. I hope that the WHATWG and W3C review all of the efforts that the web dev community have put into the picture
element proposal in their own community group and go back on this recent addition.
Syntax aside... if srcset
was here to stay regardless of what we want, is there any way we could make it work in existing browsers without introducing unnecessary overhead or potentially buggy markup? At a glance, it looks shaky to me.
The main problem is request overhead, and attempting to work around that.
Given the following markup, existing browsers will prefetch/fetch the image referenced in the src
attribute, and JavaScript can not prevent that request from going out. This means larger screen devices will request an unnecessary image for every imgset
on a page - not good.