I've noticed that inside Ajax.Request's respondToReadyState function,
when the readyState is "Complete", the onSuccess callback is called
before the onComplete callback.

This behavior has some important ramifications when using onSuccess
with Ajax.Updater, and I was curious if the execution sequence was a
mindful decision.

The scenario I have is using Ajax.Updater to fill an element with
content, and in my onSuccess callback, running code that depends on
new content being in my element. Ajax.Updater does its HTML insertion
on the onComplete callback. What this means is that when onSuccess
runs, it doesn't know about the new content because the new content
hasn't actually been updated.

I know, at first glance, onComplete seems to be the most logical
choice of what to call _last_. I am just imagining that a good number
of people who use onSuccess with Ajax.Updater would expect to have the
new content be accessible at that time.

What I was trying to accomplish doesn't _seem_ like an edge case, but
if it is, perhaps it should be documented. I was particularly confused
when two callbacks (onSuccess and onComplete) which should happen at
the same time -- at least conceptually, in my mind -- reflected
different states.

I'm not asking to change one of the foundational behaviors of
Prototype -- yet :) Just looking for some insight from the developers'
points of view.

Thanks team!

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 

Reply via email to