Re: Comments about lazyload & postpone

From:  Jatinder Mann <jmann@microsoft.com>
Date:  Friday, September 27, 2013 6:22 PM

>> > 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 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.

If "we shouldn't bother even downloading until after DOMContentLoaded"
(which I agree should be the case) perhaps I'd be best to specify that
instead. Because saying so, negates the implication as to whether it has any
potential to actually delay DOMContentLoaded at allŠ The ideal here is to
allow DOM manipulation using  javascript on 'interactive' or with 'defer'
scripts prior to any of the delayed resources start loading.

>> > 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.

The use case as I see it, would be replacing an image src with its proper
responsive size. The replacement can be done on 'interactive' or on 'defer'
just prior to DOMContentLoaded. But for that to be possible, it means that
lazyload or postpone resource MUST not start before DOMContentLoaded.

Another use case for say, a mobile phone, would be to remove part of a
'responsive' DOM element, with a lazyload or postpone attribute, completely,
as an alternative to hide it. Again before DOMContentLoaded.

> Regardless, we will need to specify the expected behavior here, whether
> removing the attribute has any effect or not.

In respect with the above script order: If a lazyload attribute is removed
from a script prior to DOMContentLoaded, the script can become a "script
that will execute ASAP" which then delays the Document 'complete' readyState
in accordance with current specs. So technically no lazyload or postpone
resources should start before the 'complete' state fires. I think it's even
more clear that way.

>> > 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
> 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 Friday, 11 October 2013 06:29:37 UTC