W3C home > Mailing lists > Public > public-web-perf@w3.org > September 2013

Re: Comments about lazyload & postpone

From: Podjarny, Guy <gpodjarn@akamai.com>
Date: Mon, 30 Sep 2013 15:48:33 -0500
To: Jatinder Mann <jmann@microsoft.com>, "public-web-perf@w3.org" <public-web-perf@w3.org>
Message-ID: <CE6F12B2.45235%gpodjarn@akamai.com>
Thanks for the comments, I basically agree with all of them.

See below a few further clarifications.

--
Guy Podjarny | CTO, Web Experience

From: Jatinder Mann <jmann@microsoft.com<mailto:jmann@microsoft.com>>
Date: Saturday, September 28, 2013 3:22 AM
To: Guy Podjarny <gpodjarn@akamai.com<mailto:gpodjarn@akamai.com>>, "public-web-perf@w3.org<mailto:public-web-perf@w3.org>" <public-web-perf@w3.org<mailto:public-web-perf@w3.org>>
Subject: RE: Comments about lazyload & postpone

> I assume lazyload on a link tag won't block rendering either, but it's not explicitly stated.
I have updated the spec to state that User Agents must not block rendering on stylesheets that have the lazyload boolean attribute.

> If a page holds multiple link tags to stylesheets, and some of them have the lazyload attribute, what's the cascading order?
> Is it in the order of appearance in the DOM, or the order in which they were processed (I.e. The lazy loaded ones are last).
> Also, what's the cascading order between multiple lazy loaded stylesheets? This seems to be addressed for links, since
> as soon as ordering is needed, lazyload is ignored.
I would lean towards all non-lazyloaded stylesheets in document order, and then all lazyloaded stylesheets in document order. Would you consider another approach?

I think that makes sense, and needs to be called out specifically.
I can imagine a few HTML examples where it would feel less intuitive (e.g. 3 CSS links in a row, the middle one has lazyload, implying the cascade order is actually 1, 3,2). That said, the only scenario that makes sense from a load process perspective is applying all non-lazyloaded in doc order and then all lazy loaded in doc order.

> I assume postpone and lazyload objects don't delay DOMContentLoaded either? Is there a requirement to not download a
> lazy-loaded resource until DOMContentLoaded has been fired?
Thatís correct, neither lazyload or postpone should delay DOMContentLoaded Ė I have updated the spec to make that clear. I donít have any specific statement that says we shouldnít even bother downloading a lazyloaded resource until after DOMContentLoaded has fired. The developer can state their intention to the User Agent to reduce the download priority, but I donít think we need to specifically state when the User Agent should do the downloading. If the UA feels it should wait longer, the UA can make that optimization on its own.

Sounds good.

> What effect can (inline or not lazy-loaded) scripts in a page can have on lazy loaded resources?
> I.e. Can a script interrupt a lazy loaded or postponed download, for instance by hiding it? Would that abort the request?
> What's the effect of a script removing the lazyload or postpone attribute? The answer to some of these may be fairly
> obvious (to me, at least), but I think it'll be good to define these behaviors in the spec.
Most User Agents will kick off the network request for a resource as soon as you specify it in script. E.g., as soon as you specify the src url for an img, the UA will kick off that network request. So if you are specifying lazyload/postpone by script, itís important to set the attributes before you specify the src. Removing the lazyload attribute after the User Agent has already fired off the request will have no impact.
If the User Agent hasnít already started downloading the resource, there may be a use case to change the behavior if script removes the attribute. E..g., you remove the postpone attribute from footer images on your page after five seconds, even if the user doesnít see them, and expect the User Agent to download them right away. Is this the use case you were thinking of? I donít yet have a sense for how common this would be.
Regardless, we will need to specify the expected behavior here, whether removing the attribute has any effect or not.

Yes, the use-cases I was thinking about are mostly ones where JS removes the lazyload/postpone properties, not adds them.
Proactively downloading all or some of the "below the fold" images is a good use-case that we often advocate (load critical content first, then the rest). A similar one is a responsive site un-postponing CSS or scripts that match its current viewport size (related to the DOMContent Loaded point above).

I think explicitly stating that once the UA should download the resource as soon as the postpone/lazyload attributes were removed is the right way to go.

> I assume this replaces the img defer attribute? (http://lists.w3.org/Archives/Public/public-web-perf/2013Apr/0063.html)

Yes, lazyload and postpone replace the initially proposed Ďdeferí attribute. As we want lazyload to impact script and script already has a defer attribute, to avoid creating a compatibility issue we have gone with a new name.

Thanks,
Jatinder

From: Podjarny, Guy [mailto:gpodjarn@akamai.com]
Sent: Friday, September 6, 2013 7:05 AM
To: public-web-perf@w3.org<mailto:public-web-perf@w3.org>
Subject: Comments about lazyload & postpone

All,

I recently read through the "Resource Priorities" draft (https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/ResourcePriorities/Overview.html).
I really like it, and feel like it captures the vast majority of what I'd like to see in such a capability.

I do have a few comments/thoughts on it, though:

 1.  I assume lazyload on a link tag won't block rendering either, but it's not explicitly stated.
 2.  If a page holds multiple link tags to stylesheets, and some of them have the lazyload attribute, what's the cascading order? Is it in the order of appearance in the DOM, or the order in which they were processed (I.e. The lazy loaded ones are last). Also, what's the cascading order between multiple lazy loaded stylesheets? This seems to be addressed for links, since as soon as ordering is needed, lazyload is ignored.
 3.  I assume postpone and lazyload objects don't delay DOMContentLoaded either? Is there a requirement to not download a lazy-loaded resource until DOMContentLoaded has been fired?
 4.  What effect can (inline or not lazy-loaded) scripts in a page can have on lazy loaded resources? I.e. Can a script interrupt a lazy loaded or postponed download, for instance by hiding it? Would that abort the request? What's the effect of a script removing the lazyload or postpone attribute? The answer to some of these may be fairly obvious (to me, at least), but I think it'll be good to define these behaviors in the spec.
 5.  I assume this replaces the img defer attribute? (http://lists.w3.org/Archives/Public/public-web-perf/2013Apr/0063.html)
Cheers,
Guypo

--
Guy Podjarny | CTO, Web Experience, Akamai
Received on Monday, 30 September 2013 20:50:09 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 18:01:21 UTC