Re: [csswg-drafts] [css-conditional] [css-contain] `srcset` and `sizes` interaction with container queries (#5889)

Has any of the discussion for this considered looking at the problem from a different angle?

`srcset` had one major design flaw, or rather, two related ones:
1. no constraint on the images in the set being required to be same-aspect; and
2. no a-priori knowledge of the aspect ratio.

Introduce that constraint and introduce an attribute that can provide that aspect ratio and suddenly for initial viewport rendering you can speculatively download whatever is smallest. If once layout happens the image hasn't been downloaded yet, then you can abort the pending request and transparently upgrade to the appropriate sized image.
If once layout happens and the image _has_ been downloaded, start the upgrade request anyway, but at least you'll have a crude placeholder to use for first paint. A placeholder that can be transparantly replaced later, because of the constraint on the images being same-aspect - i.e. you *know it will not shift layout.*
 
Doesn't even have to be the smallest defined image in the srcset.
Could be a separate property altogether. Like how `<video>` has a `poster` attribute.


-- 
GitHub Notification of comment by rjgotten
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/5889#issuecomment-1455845325 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Monday, 6 March 2023 10:11:45 UTC