[ResourcePriorities] Scripts and integration with HTML spec

I was recently introduced to the Resource Priorities spec, in the context 
of a discussion at the WHATWG for how to provide more control to authors 
around loading of scripts and the <script> element.

I'm interested in making sure that we don't end up with conflicting 
requirements, or a weird inconsistent design overall (with some elements 
working one way but others working another).

The Resource Priorities spec proposes that the <script> element support an 
attribute that basically acts like async="" except it makes the loading 
have an even lower priority. 

The use cases that I studied for script preloading need more than just 
that; in trying to address them I proposed a couple of new attributes that 
set up a dependency mechanism (search for "Here's a proposal" to jump to 
the meat of the e-mail):


(The proposal has issues and wouldn't be adopted as is; the point is just 
to illustrate that the proposal overlaps with the Resource Priorities 
proposal and isn't trivially the same.)

Does anyone have an opinion on how we should proceed here?

Regarding the other elements: in general, we should probably integrate the 
HTML aspects of the Resource Priorities spec more closely with the 
processing models in the HTML spec. (For example, "The User Agent parser 
MUST NOT block launching new script contexts on stylesheets" conflicts 
with the normative text in HTML around the concept of "a style sheet that 
is blocking scripts".) There's several ways we could do this; we could 
simply have it all speced in the HTML spec, or we could adjust the 
Resource Priorities spec to hook into the HTML spec -- in the latter case, 
I'd be happy to provide any required hooks to make that easier.

What's the implementation status of this proposal? Does it have browser 
vendor buy-in? Do people think we should spec this in straight in the HTML 
spec, or would a hook-based approach work better for people?

It may also be worth making sure that we bear in mind this request 
regarding cookie control:


Since it affects the same features for which you'd want to control load 
priorities, it might want to use the same mechanism. I haven't studied 
this particular problem in detail yet. The security-focused CSP may also 
be a way to address this particular problem.

Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

Received on Monday, 9 December 2013 19:54:24 UTC