[whatwg] Media aware JS loading

David Bruant bruant.d at gmail.com
Tue May 21 08:56:54 PDT 2013

Le 16/05/2013 15:22, Yoav Weiss a écrit :
> Arguably, the biggest problem in responsive Web design today is the fact
> that many resource loading mechanisms are media query agnostic, and
> download resources upfront regardless of whether they will be used or not.
> One of the biggest resources in question (right after images) is external
> JavaScript. JavaScript also has secondary performance effects, beside its
> download size, since parsing and running it are also time (& battery)
> consuming operations.
> Currently authors that want their scripts to load only under certain
> viewport sizes are forced to use JS based script loaders, which have the
> side-effect of preventing these scripts from being parsed out by the
> preloader.
How bad is the current situation with JS-based loaders? I would expect a 
JS-based loader and the couple of feature-detection tests to be rather 
small as well as heavily cachable, so not that awful for performance.

I'm not sure I understand your point about preloading scripts parsing. 
Do you want them to be preparsed (which costs in battery as you mention) 
or not preparsed (which will result in longer time when actually needing 
the script)?

> I believe that an HTML based solution would be a better fit, will be easier
> to use by authors, and will enable preloaders to do their job and preload
> these scripts.
How much time can be expected to be gained from such a feature given the 
state-of-the-art JS loaders?

Overall, what is the expected gain between a JS-based loader and a 
declarative media-aware loader? 1ms? 100ms?



More information about the whatwg mailing list