Nice reasoning. I've added a couple more examples, and will report
this as a bug.

Examples have been updated with descriptive text.
http://dev.y2g.org/?page=preDOM
http://dev.y2g.org/?page=postDOM
http://dev.y2g.org/?page=postDOM_1
http://dev.y2g.org/?page=postDOM_2

A summary of 'how to fix' right now would be... if you're going to
call google.load('maps'....
you MUST specify a 'callback' in your options param like

google.load('maps', '2', {callback:/*functionname*/});

as long as callback is present (doesn't even need to be a function, I
assigned {} in a test) the DOM isn't destroyed. For form's sake if one
is not going to do an actualy callback function I suggest using an
empty anonymous one ..

google.load('maps', '2', {callback:function(){}});

Thanks Marcelo, JavaJ, Rossko.

On Jun 24, 8:16 am, Rossko <[email protected]> wrote:
> > <body onload="javascript:google.load( 'maps', '2' );
> > google.setOnLoadCallback(alert('Boo!');init(););" onunload="GUnload
> > ()">
>
> The way I'd interpret that is -
> After the DOM is complete, the AJAX loader is requested to go fetch
> the maps API.
> NO onloadcallback function has been set at all for that maps request.
>
> Then we set an onloadcallback for the loader itself, which will in
> turn call init() whatever that may be, but let's guess its a map
> initialising routine.  There's no guarantee that the maps API will be
> loaded before init() is called, bearing in mind this onloadcallback is
> all about the loader itself.
>
> The normal approach to going about it this way would be to do the
> google.load('maps'..) inline in the head
>  http://code.google.com/apis/ajax/documentation/#GoogleLoad
> Presumably the loader is smart enough NOT to trigger its onload until
> all the modules which it was originally told about are loaded too.
>
> Or, if you do need the maps API loaded after the DOM is complete
> (which is what putting the request in the body onload implies) - the
> usual way to do that would be to set init() as the onloadcallback of
> the maps load request?http://code.google.com/apis/ajax/documentation/#Dynamic
>
> Seems to me there's two ways to go about it, but care needs to be
> taken to use the appropriate callback, and mix'n'match of the two
> methods causes tears.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Maps API" 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/Google-Maps-API?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to