Dan Webb's LowPro[1] "solves" this kind of issue by registering a global Ajax.Responder that evaluates DOMContentReady behaviors onComplete.
Thinking along similar lines, you could wrap Event.observe so that observers set for contentloaded are also stored into a queue that gets processed after every Ajax.onComplete. I'm just spilling my thoughts here, but I think it would work well for most cases. How do you feel about this? (and, does it have any major drawbacks I'm not seeing?) Best, -Nicolas [1]: http://svn.danwebb.net/external/lowpro/trunk/ On 8/30/07, Jeff Watkins <[EMAIL PROTECTED]> wrote: > > Having prototype simulate the DOMContentReady event for those > browsers that don't support it is wonderful, however, what is the > plan for calling late registrants? > > For example, imagine you have a widget which would like to perform > its initialisation only after the DOM is ready. It registers a > listener for contentready on the document. All is fine. Now let's add > Ajax to the mix. The widget is instantiated via content injected via > Ajax. The registration for contentready will never be called. > > The solution I've been using is based on someone's Event.onDOMReady > code: if the event has already been fired, I call the listener after > a brief delay (to maintain the implicit contract "call this function > later") via window.setTimeout(fn, 0). > > Am I missing something critical about the implementation of the > synthesised contentready event? > > On the other hand, maybe contentready isn't the right answer here, > because when browsers _really_ support DOMContentReady, it won't do > what I want anyway. > > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Prototype: Core" group. To post to this group, send email to prototype-core@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~----------~----~----~----~------~----~------~--~---