RE: [ResourcePriorities] Blocking content resources on CSS properties

On Tue, Nov 5, 2013 at 10:32 AM, Simon Sapin wrote:
> Because the 'postpone' value of that properties is a "must", this means that the decision to fetch a resource 
> is blocked on resolving the value of a CSS property, which itself may depend on fetching external stylesheets.
>
> There are two issues with this:
>
> * This introduces a circular dependency. You don't know when you're supposed to fetch a stylesheet until 
> after you've applied it.
>
> * Some browsers speculatively parse HTML to find images and other resources and start fetching them as 
> soon as possible. CSS properties may not be resolved yet at that point. Waiting for them introduces unnecessary delays.

Yes, you are right that the CSS property will most likely not be resolved until a later time. As the spec is currently written, there doesn't seem to be any way to implement resource-priories:'postpone' short of not preloading any resource until CSS properties have been resolved. Not preloading any resource, including those without postpone/lazyload, is a bad design and will slow down page loads.

Seems like it makes most sense to scope the CSS property to only apply to resources downloaded by a CSS rule: 'background-image', 'border-image-source', 'content', 'cursor', 'list-style-image', and '@font-face src'. 


On Tue, Nov 5, 2013 at 5:58 PM, Boris Zbarsky wrote:
> Browsers start image loads as soon as you set the src; web compat requires that.  This happens way before the browser 
> knows what the style of the <img> is (and in fact often before the <img> is even in the document).

Agreed. As the parser will encounter the lazyload/postpone content attributes, seems like that is the best way to specify whether the download of a <img> should be delayed. As I mentioned above, I think the resource-priorities CSS rule should be limited to resources downloaded via CSS with the resource-priorities CSS rule applied.


On Wed, Nov 6, 2013 at 4:57 AM, Ivan Kotenkov wrote:
>  I suggest that the spec should state that changing the attribute should have no effect if the resource is already 
> being downloaded.

I agree that the spec should clarify that if a developer sets the IDL attribute via script after the UA has already started downloading a resource that nothing should happen (e.g., download shouldn't be cancelled).

Thanks,
Jatinder

Received on Wednesday, 6 November 2013 18:40:13 UTC