W3C home > Mailing lists > Public > whatwg@whatwg.org > September 2012

Re: [whatwg] Deferring javascript download and execution until after onload

From: Jonas Sicking <jonas@sicking.cc>
Date: Tue, 18 Sep 2012 01:59:04 -0700
Message-ID: <CA+c2ei-Krf8oR4XMacQ318-PbrKo-71W=kHAUde0YNWKHFVH3g@mail.gmail.com>
To: "Tab Atkins Jr." <jackalmage@gmail.com>
Cc: Rick Waldron <waldron.rick@gmail.com>, Andy Davies <dajdavies@gmail.com>, WHATWG List <whatwg@whatwg.org>
On Tue, Sep 18, 2012 at 1:28 AM, Tab Atkins Jr. <jackalmage@gmail.com> wrote:
> On Tue, Sep 18, 2012 at 10:26 AM, Rick Waldron <waldron.rick@gmail.com> wrote:
>> On Tuesday, September 18, 2012 at 2:54 AM, Jonas Sicking wrote:
>>> There has been discussions about implementing a "noexec" attribute on
>>> <script> which would just load the script but instead of evaluating it
>>> as soon as it's available, simply fire the "load" event. There would
>>> also be an additional .execute() function on the script which would
>>> permit executing the script after it has been loaded.
>> What happens to the execute() function after the first time it's called? Is it magically removed? Is it nulled? If not, what happens when it's called twice for the same script?
> It presumably sets the "has run" flag on the <script>, so the second
> call simply does nothing.

Yeah, it'd set the "has run" flag.

If calling .execute() on a "has run" script is a no-op or causes an
exception to be thrown I don't really have a strong opinion about. We
would need to pick one and document it. If people have strong opinions
one way or another I'm all ears.

/ Jonas
Received on Tuesday, 18 September 2012 09:00:03 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:45 UTC