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

Re: [whatwg] Deferred Javascript parsing

From: Garrett Smith <dhtmlkitchen@gmail.com>
Date: Mon, 29 Apr 2013 15:41:14 -0700
Message-ID: <CABZUbM0x3g8NLPCikGXcUe45M2n7J7wPcXxH+_25sL7Udb=cMA@mail.gmail.com>
To: David Bruant <bruant.d@gmail.com>
Cc: whatwg@lists.whatwg.org, Benjamin Stürmer <benjamin.stuermer@gmail.com>
On 4/29/13, David Bruant <bruant.d@gmail.com> wrote:
> Le 29/04/2013 22:21, Benjamin Stürmer a écrit :
>> I have been reading about a technique described here (
>> http://googlecode.blogspot.de/2009/09/gmail-for-mobile-html5-series-reducing.html)
>> for deferring the parsing of scripts until they are actually required.
>> This
>> can be a useful technique for allowing lazy-loading of script without
>> AJAX.
>> A common method used to achieve this (the method described in the linked
>> article) is commenting-out blocks of code and then uncommenting it and
>> running it via eval(), which is obviously not an ideal solution.
Obviously not. Nor will it work for external SCRIPT elements (not "tags").

>> Has there been any consideration given to an attribute to mark a script
>> tag
>> as "do not parse or execute" until it's been triggered?
David Anderson proposed the 'execute' method. Great idea; no traction.
Also http://lists.w3.org/Archives/Public/public-whatwg-archive/2011Feb/0245.html

A shame that the examples aren't up anymore (can't work for free on this).

The replies on by Boris and Ian include some mistakes and distract
about setTimeout, unfortunately.

> I think if you put any invalid value in the "type" attribute of the
> script element, then, the element won't be parsed nor executed. If your
> script element has a given id, you can easily find the code
> (document.getElementById(id).textContent) and eval it.
Obviously not an ideal solution.
Twitter: @xkit
Received on Monday, 29 April 2013 22:41:40 UTC

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