by hcarvalhoalves · 13y ago · 0 comments
I can see from here the compatibility and complexity trainwreck we're going to have down the line.
Other than 1x and 2x what are we supposed to expect to use here with this? Is there going to be 4x?
You can see they are basically getting this very vendor-specific hack they already had and calling it a standard. That's heresy.
They've done the same thing with resolution independence on iOS - instead of some sensible system of scaling and caching, we've ended up with a situation where images and icons are saved in several different versions by the developer just to cope with all the different possible resolutions/ratios using this sort of @2x naming scheme, and all based off arbitrary resolutions of screens which are going to change. It's a mess.
I think they'd be better with something like this:
<picture>
<source src="myjpg.jpg" width=100 height=100>
<source src="myjpglrg.jpg" width=1000 height=1000>
<img src="myjpg.jpg" alt="fallback img tag or text">
</picture>
We already have this scheme of source elements for audio and video, and this is the perfect moment to introduce something a bit more sane for images too. There's no need for the specification of arbitrary resolution intents if you give the src sizes. This would also let us transparently handle new file formats with fallback to older ones with type attributes, as with audio and video tags. For example you might start introducing SVG versions of many images, but leave a png source in there for older browsers.The above proposal already displays perfectly fine in older browsers if you use an img tag within the <picture> tags for backwards compatibility, and could easily be dealt with in older IE with workarounds if necessary, though I think the img tag would display fine.
CSS can then be used to control the intended display size.
> From the available options, the user agent then picks the most appropriate image.
So if you are zoomed in, the UA can decide that a higher-res image is the most appropriate one.
[0]: http://www.whatwg.org/specs/web-apps/current-work/multipage/...
[0]: http://www.whatwg.org/specs/web-apps/current-work/multipage/...
No, that's HTML5.
is complexity that simply can't happen with srcset. Similarly one needs to consider the behaviour of preloaders in extant UAs; if existing browsers will start to download all the images that will create a much worse user experience in the short term.
I don't remember what all the considerations were here, but this is a much harder problem than many people give credit for, and certainly isn't a case where a single vendor controlled the whole process.
<picture><source media="min-resolution: 2ppx"></picture>
but mere query doesn't affect intrinsic size of the image, so you'd also need to specify exact dimensions in the markup or something like: <picture>
<source media="min-resolution: 2dppx" style="image-resolution: 2dppx">
</picture>
which is rather verbose and error-prone compared to srcset.> Other than 1x and 2x what are we supposed to expect to use here with this? Is there going to be 4x?
I don't think so (meaning of "1x" gradually changed from 72dpi to 100-130dpi, so I expect "2x" similarly gradually increase) and I proposed that new image embedding methods default to @2x, but that idea hasn't gained support from CSS/HTML WGs.
<audio controls>
<source src="horse.ogg" type="audio/ogg">
<source src="horse.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>> Note that at the moment WebKit only supports the resolution modifiers (e.g. 1x, 2x, 3x).
The official [draft] specification: http://www.w3.org/html/wg/drafts/srcset/w3c-srcset/
The dimensions in the srcset attribute are the maximum (viewport) dimensions that an image is intended for. e.g.:
<img src="pear-mobile.jpeg" srcset="pear-mobile.jpeg 720w, pear-tablet.jpeg 1280w, pear-desktop.jpeg 1x" alt="The pear is juicy.">