[whatwg] <imgset> responsive imgs proposition (Re: The src-N proposal)

John Mellor johnme at google.com
Fri Nov 15 09:19:34 PST 2013

On Fri, Nov 15, 2013 at 5:12 PM, Shane Hudson <mail at shanehudson.net> wrote:

> Could I just please clarify, since its been hard to follow the
> conversation, that having the style internal means that the prefetcher can
> still handle the images properly?

Yes, *but* only if you use a limited subset of CSS. Adam suggested earlier
(quoted below), that the preparser would only be able to match simple
selectors (like class and id), but not selectors that need to understand
the structure of the DOM tree (e.g. descendant or sibling selectors).
Personally, I suspect authors would trip up on this quite a bit.

On Tue, Nov 12, 2013 at 6:49 PM, Adam Barth <w3c at adambarth.com> wrote:
> The hard part is deciding what to put in the optimized subset.  We
> already parse media queries in the preload scanner to find imported
> stylesheets to load.  We probably won't be able to support every media
> query under the sun, but we could support maybe min-width, min-height,
> and min-device-pixel-ratio (or whatever you think is best along these
> lines).
> For selector matching, we wouldn't be able to support anything that
> needs to understand the structure of the tree (e.g., descendant
> selectors or sibling selectors).  I'd probably start with just single
> class and id selectors.
> In case it wasn't clear from the above, we wouldn't preload the image
> until we'd encountered the div with the appropriate class name.  When
> scanning that start tag token, we'd simulate CSS selector matching in
> the preload scanner to see if we've understood any rules that match.
> None of the above is all that difficult, and it's probably something
> we should do anyway to improve image preloading across the whole web.
> Adam

More information about the whatwg mailing list