Re: XHTML Applications and XML Processors [was Re: xhtml 2.0 noscript]

On 02/06/07, Ian Hickson <ian@hixie.ch> wrote:
> > When I've though about this in the past, I've concluded that the current
> > specifications are inadequate when there are multiple download streams.
> > E.g., if, as ought to be good practice, the scripting library is in a
> > .js file, does anything specify what happens if a function is called
> > before the parallel load of the scripting file completes (and the
> > declaration hasn't yet been seen)?
>
> The specs define this (you get an exception), but it isn't exactly clear
> to me what we can do to make this better in a way that authors would
> actually leverage.


... just brainstorming a little...

How about a new object:
window.loadedScripts {DontEnum, DontDelete , ReadOnly}

All scripts are inserted as properties (using their URL as property
name) in it they have executed. So, one can do:

if ( 'http://example.net/niftylibrary.js' in window.loadedScripts)
    doSomething();


More useful:
window.loadedScripts.addDependentFunction ( EventListener [, URL1 [,
URL2 [, ...]]] )

Executes the listener once all dependencies have been executed, or
immediately if already done.
-- 
David "liorean" Andersson

Received on Saturday, 2 June 2007 07:21:20 UTC