[whatwg] Script preloading

Glenn Maynard glenn at zewt.org
Fri Aug 30 17:54:49 PDT 2013

I don't like the name "jit", because it already has a different meaning
when talking about scripting.  If this was for CSS or WebVTT or something
else other than scripts, it wouldn't be as bad...

On Fri, Aug 30, 2013 at 7:22 PM, Ryosuke Niwa <rniwa at apple.com> wrote:

>  I don't quite understand why we need two values for "whenneded".
> Why can't we simply have "prefetch" (since we already use that term in the
> link element) and "needs" (I'd prefer calling it "requires") content
> attributes?
> When a script element has the prefetch attribute, it doesn't execute until
> execute() is called upon the element unless
> (i.e. the script is executed immediately when the script has been loaded)
> if at least one of its dependencies is not a prefetch
> (i.e. doesn't have the "prefetch" content attribute).

I'm not sure what you mean (skipping the parenthetical this says "unless
if", so I'm not sure how to parse that), but "prefetch" sounds like
something different than "jit".

"prefetch" sounds like a hint about networking behavior, eg. "download this
script, even if it isn't needed yet".  On the other hand, "jit" changes
when the script is executed, not when it's downloaded: it means "don't
execute the script's contents until the scripts that depend on this one are
also ready to be downloaded".

Could you clarify which use case this alternative proposal doesn't address?

The use case was "download several scripts, then execute them all at
once".  I'm not sure about that use case, but a prefetch hint doesn't seem
right for that.  You'd end up downloading the scripts even if they're never
used.  With "jit", the browser can still avoid downloading the scripts
entirely if they're not used.

Glenn Maynard

More information about the whatwg mailing list