[whatwg] The src-N proposal
Yoav Weiss
yoav at yoav.ws
Wed Nov 20 04:32:09 PST 2013
On Tue, Nov 19, 2013 at 11:22 PM, Tab Atkins Jr. <jackalmage at gmail.com>wrote:
> On Tue, Nov 19, 2013 at 2:07 PM, Simon Pieters <simonp at opera.com> wrote:
> > So:
> >
> > <picture>
> > <source ...>
> > <source ...>
> > <img src="fallback" alt="...">
> > </picture>
> >
> > The selection algorithm would only consider <source> elements that are
> > previous siblings of the <img> if the parent is a <picture> element, and
> > would be called in place of the current 'process the image candidates' in
> > the spec (called from 'update the image data'). 'Update the image data'
> gets
> > run when an img element is created, has its src or crossorigin (or
> srcset if
> > we still want that on img) attributes changed/set/removed, is inserted or
> > removed from its parent, when <source> is inserted to a <picture> as a
> > previous sibling, or a <source> that is a previous sibling is removed
> from
> > <picture>, or when a <source> that is a previous sibling and is in
> <picture>
> > has its src or srcset (or whatever attributes we want to use on <source>)
> > attributes changed/set/removed. 'Update the image data' aborts if the
> > parser-created flag is set. When img is inserted to the document, if the
> > parser-created flag is set, the flag is first unset and then 'update the
> > image data' is run but without the await a stable state step.
>
> +1. I'm totally fine with this, if the people who disliked multiple
> attrs are okay with multiple elements.
>
> We can still handle all the things that src-N did, without the need
> for such compact microsyntaxes, too:
>
> 1. Art direction is handled by <source media>.
> 2. Multiple densities is handled by a list of url/density pairs in <source
> src>.
> 3. Variable-size images can be handled with a <picture sizes>
> attribute, and a list of url/size pairs in <source src>.
>
+1 as well.
I think it's worth while to enable the `sizes` attribute and url/density
pairs on <img> as well.
It would enable authors that have just variable-width images with no
art-direction to avoid adding a <picture> with a single <source>.
Also, the Client-Hints specification can rely on `sizes` (on both <picture>
and <img>) for the resource-width header value, even if only a URL (with no
density) is specified.
More information about the whatwg
mailing list