W3C home > Mailing lists > Public > www-style@w3.org > July 2013

Re: lazy loading for images via css

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Wed, 3 Jul 2013 14:29:10 -0700
Message-ID: <CAAWBYDAi2K9P9nKos3jrNRWLMntHEtzmry6TijcQpO=-6sTFYQ@mail.gmail.com>
To: Felipe Nascimento de Moura <felipenmoura@gmail.com>
Cc: Yoav Weiss <yoav@yoav.ws>, Simon Sapin <simon.sapin@exyr.org>, Liam Quin <liam@w3.org>, Bjoern Hoehrmann <derhoermi@gmx.net>, www-style <www-style@w3.org>, brice@websailors.fr
On Wed, Jul 3, 2013 at 2:19 PM, Felipe Nascimento de Moura
<felipenmoura@gmail.com> wrote:
> On Tue, Jul 2, 2013 at 12:44 PM, Tab Atkins Jr. <jackalmage@gmail.com>
> wrote:
>> Yes, I wouldn't intend it to be anything more than a hint that the
>> browser is allowed to load it "later": after all critical resources
>> but then otherwise unconstrained (except that they must load when they
>> come into view).
>
> Well, this would be quite useful, no doubt!
> But wouldn't it give more power and options to developers if they could
> actually say that no image shall be downloaded unless they said so?
> I imagine it comparing that idea used by Google and Facebook in which they
> load their scripts commented, and only "eval" it when they need, piece by
> piece.
> When it JS was created and allowed developers to get their content as
> string/text(and then eval it or not), I bet they never thought it would be
> used that way, for those reasons.
> I mean, developers will find a way to make it useful in ways we can't
> imagine right now, as long as we give them options.

More power isn't always more better.  Authors can already choose when
to load an image, by just not putting it in the CSS at all, and
letting JS set 'background' or whatever later.

> Telling the browser to prioritize or not a load is useful, but it would also
> be useful to load the resources in another moment...for example, after a
> javascript has validated that the user is using a mobile device, or that it
> is under a 3G connection or not.

This is not something the JS dev should be worrying about in the
slightest; getting it right is very non-trivial (I talk about this
some in my blog post <http://www.xanthir.com/blog/b4Hv0>).  It's
handled automatically by the image-set() function, which is in the
Image Values 4 spec.

~TJ
Received on Wednesday, 3 July 2013 21:29:57 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 3 July 2013 21:29:57 UTC