W3C home > Mailing lists > Public > public-respimg@w3.org > July 2015

Re: [picture] spec text regarding sibling sources needing media or type attr

From: Yoav Weiss <yoav@yoav.ws>
Date: Sun, 19 Jul 2015 18:27:44 +0200
Message-ID: <CACj=BEjWm5ZnpObjka9X1hok5Z7XYyop2Lbp5jxuE9_yEtdUyw@mail.gmail.com>
To: Greg Whitworth <gwhit@microsoft.com>
Cc: "public-respimg@w3.org" <public-respimg@w3.org>
That's part of the authoring requirements, not the processing model. That
syntax is invalid, yet processed just fine.

The reason it is invalid IIRC, is that in that construct, the <source>
element always gets picked, making following <source> elements and the
<img> redundant as far as resource selection is concerned.

In your example, the following syntax would have been sufficient:
<img sizes="(min-width:
500px) 100px" srcset="http://placehold.it/1000 1000w">

Feel free to open GH bugs in the future if there's anything unclear
regarding the spec :)


On Fri, Jul 17, 2015 at 9:37 PM, Greg Whitworth <gwhit@microsoft.com> wrote:

> Hello all, hoping I can get an answer to my question regarding this line
> in the spec:
>         # When a source element has a following sibling source element or
> img element with a srcset attribute specified, it must have at least one of
> the following:
>         # A media attribute...
>         # A type attribute...
> Reading this makes me believe that the following[1] should error out on at
> least the first one, the second one is technically valid but the first one
> is selected in both Chrome and Firefox.
>         <picture>
>                 <source sizes="(min-width: 500px) 100px" srcset="
> http://placehold.it/1000 1000w">
>                 <source media="(max-width: 500px)" srcset="
> http://placehold.it/500">
>                 <img srcset="http://placehold.it/500">
>         </picture>
> Any insight into why this is allowed would be appreciated. Thanks,
> Greg
> [1]  http://jsbin.com/xojeridipe/1/edit?html,js,output
Received on Sunday, 19 July 2015 16:28:12 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:06:17 UTC