I just tested this in a variety of ways and both John's and Phil's methods work great and you're right: appendChild and prependChild both work.
Cool! **--** Steve On Oct 9, 10:44 pm, Michael Geary <[email protected]> wrote: > prependChild or appendChild wouldn't make any difference; they're both > asynchronous. > > Regarding that sub-packet-sized package with a fast timeout, how would you > implement that short of recompiling the browser? :-) > > -Mike > > On Fri, Oct 9, 2009 at 6:54 PM, Steven Black <[email protected]> wrote: > > > First of all, thanks @jresig because that's just way too elegant. I > > was anticipating something far more complex. > > > A couple of questions: > > > Ifhttp://cdn/jQuery.jsfails, we want the local-domain jQuery.js to > > load next, BEFORE the any other subsequent script which is likely a $ > > (function(){}) or a call for plugin, both of which have a jQuery > > predicate. So I don't sense that Phil's ...('head')[0].appendChild > > (script) would work reliably. Am I wrong about that? Does this > > really work as you expect, Phil? I would expect a prependChild(), no? > > > Second, Dave raises another crux of the matter: we need to bail to the > > failover ASAP, ideally within a second or two. It's almost as if we > > need the CDNs to also provide a sub-packet-sized package we could > > request, wrapped inside a very short timeout to bail to the failover. > > > **--** Steve > > > On Oct 9, 9:10 am, Dave Methvin <[email protected]> wrote: > > > > I took this great idea and went ahead implementing it on a few sites I > > > > maintain using different syntax. > > > > It's more than a syntax change; it's entirely different semantics. > > > Your version fetches a copy of jQuery asynchronously. If there is > > > a .ready() handler below that block of code, jQuery may not be loaded > > > by the time it is reached and you'll get errors. By using > > > document.write and a script tag, you can be guaranteed that the > > > browser won't proceed to run any code below it until it either loads > > > the script or gets an error back from the request (like a 404 or a > > > timeout). > > > > I'd think the timeout situation is the most likely outcome when > > > Google's CDN is down, which means the user will see a blank screen for > > > 30 to 60 seconds before it even reaches the document.write anyway. So > > > it seems like you'd need to load the Google CDN version asynchronously > > > to prevent that. But that raises the question of what to show the user > > > while it's trying to find a reachable version of jQuery... > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "jQuery Development" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~----------~----~----~----~------~----~------~--~---
