Re: lazy loading for images via css

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