Sweet, that works. Kind of. Sadly, if you are in the middle of a dom:loaded callback... document.loaded is still false. It's not true until after all the dom:loaded callbacks have been called.
And it's if you are IN a dom:loaded callback, and you then try to add another dom:loaded listener -- that's what really makes Prototype/ Firefox go all screwy. I kinda of agree with the later commenter that Prototype itself ought to take care of adding a dom:loaded callback at odd times -- if you add it after dom:loaded, it should just execute immediately. If you add it in the middle of a dom:loaded callback, it should just be added onto the end of the queue. But, sadly, that's not what happens. If you call it in the middle of a dom:loaded callback, things go screwy. If you call it after dom:loaded, your callback will never get executed. Hmm. On Jun 24, 11:49 pm, Tobie Langel <tobie.lan...@gmail.com> wrote: > yes, using document.loaded. > > Try something like: > > document.loaded ? callback() : document.observe('dom:loaded', > callback); > > Best, > > Tobie > > On Jun 24, 11:53 pm, jrochkind <rochk...@jhu.edu> wrote: > > > So prototype 1.6 lets you register an event handler for the psuedo- > > event dom:loaded. Good enough. > > > But if you register a callback for this event AFTER it's already > > happened anywhere, it'll never get called (or possibly even something > > stranger will happen, something strange was happening to me, but could > > have been my code). > > > I have some re-useable code that sometimes might get called before > > dom:loaded (in which case it wants to register a callback to do it's > > thing on dom:onload), but sometimes might get called after dom:loaded > > (in which case it would just go ahead and do it's thing). > > > Is there any way to tell if dom:loaded has happened yet? > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~----------~----~----~----~------~----~------~--~---