W3C home > Mailing lists > Public > whatwg@whatwg.org > August 2013

Re: [whatwg] Script preloading

From: Yoav Weiss <yoav@yoav.ws>
Date: Fri, 30 Aug 2013 18:08:13 +0200
Message-ID: <CACj=BEitGcV2WaYzzxWgnO-=YMfJkR4PsKfkQwrDNjRbYEHb0g@mail.gmail.com>
To: Ian Hickson <ian@hixie.ch>
Cc: "whatwg@whatwg.org" <whatwg@whatwg.org>
On Tue, Aug 27, 2013 at 11:55 PM, Ian Hickson <ian@hixie.ch> wrote:

> On Thu, 11 Jul 2013, Yoav Weiss wrote:
> >
> > I've recently contemplated the slightly related issue of adding the
> > "media" attribute to <script>, for declarative loading of scripts that
> > are only relevant to some viewports [1] While it may complicate certain
> > things (e.g. execution when media conditions change, dependencies), I
> > believe it's worth while to give it some thought, as it'd enable
> > preloaders to fetch these scripts as soon as possible, in case they are
> > needed.
> How common are media-specific scripts?

They are fairly common, especially for loading of "mobile" UI components
(e.g. jquery mobile). They can also be used to download dynamic page
components (e.g. maps) only on larger devices.
But, unless adding `media` to script elements is relatively simple, I think
that this use-case can be resolved by using the media attribute on <rel
subresource>, in combination with ES6 modules or a custom script loader. As
far as I understand it, all <link> elements can have a media attribute [1],
so this is simply an implementation issue.

Received on Friday, 30 August 2013 16:08:40 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:09:23 UTC