W3C home > Mailing lists > Public > whatwg@whatwg.org > November 2013

Re: [whatwg] The src-N proposal

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Tue, 19 Nov 2013 14:22:01 -0800
Message-ID: <CAAWBYDCxZiujKMKJ9QunGOQjrS_Jo_idmqKtr7z2CS-c+BTXCQ@mail.gmail.com>
To: Simon Pieters <simonp@opera.com>
Cc: WHATWG <whatwg@lists.whatwg.org>, James Graham <james@hoppipolla.co.uk>
On Tue, Nov 19, 2013 at 2:07 PM, Simon Pieters <simonp@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>.

For the last, since we're not trying to squeeze everything into a
single attributes, we can let the sizes='' attribute breath a bit, and
just take a list of MQ/size pairs.  Using a url/size pair in src=''
would be invalid if sizes='' wasn't specified.

~TJ
Received on Tuesday, 19 November 2013 22:22:53 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 17:00:14 UTC