Thread:Pecoes/@comment-4674838-20121012013714/@comment-4674838-20121012200705

I tried that out at VerbatimScriptTest1 and it seems to work, I used verbatim tags to inject the following JS:

Even though I've reloaded the page at least a dozen times and it always works, I'm still caught up on a couple issues, perhaps you could explain?
 * 1) A small percentage of the time, I would expect the script to fail because:
 * 2) *The first script tag installs jQuery asynchronously (because you're loading an external resource without attaching an onload handler -- there's no guarantee when the resource will be 100% loaded, all we know is that we've made a request to load it and it will finish loading "sometime")
 * 3) *Since jQuery library is being installed asynchronously, it should be possible for the script in the second script tag to execute before jQuery library is ready.
 * 4) Why does  guarantee that the global variable   is available for use?   event fires after all HTML in the DOM has been parsed, this much I know. But how does making sure that all HTML has been parsed guarantee that the mediaWiki global variable is available?