Hi everyone,

I just joined the group.
I glanced at the archive and was not able to find suitable answers  to
my various questions regarding the motivations behind certains
features of the Prototype-1.6.0.2's Ajax object and their
implementations.

I will try to keep short but precise.

1) Ajax.Request's onStateChange() callback
 Documentation states that "onLoading" callback (when readyState == 1)
is not guaranteed. It is more than that : it is *disabled by the
implementation* (1.6.0.2)

  onStateChange: function() {
      ...
      if (readyState > 1 && ...) fire_the_callback
  }

  A readyState value of 1 will result in *not firing* the callback.
  I'm missing the reason for this (should it not be '>=' ?)

2) Ajax.Response objects
A *new* Ajax.Response object is created *each time* the above callback
is fired.
I'm not sure to understand why is this necessary.

Instead, I envision a *single* Ajax.Response object per Ajax.Request,
to be updated as many times as necessary while the XHR progresses to
completion (readyState value).

The actual implementation results in some identical actions being
performed several times. For instance the slots
'responseText' (=String.interpret(transport.responseText)) and
headerJSON are computed twice, once when readyState becomes equal to 3
(Interactive), again when it becomes equal to 4(Complete).

What is the reason to this ?

3) JSON
A XHR can result in yielding a Javascript object in two ways :
- (a) from the X-JSON header
- (b) from the XHR responseText

These do not appear to be unified in the actual implementation.

For instance the option flag evalJSON (which defaults to true) does
not prevent the JS object from being built when JSON emerges from (a),
but does it when the JSON emerges from (b).

Moreover, the results are stored in two different slots : headerJSON
for(a) and responseJSON for (b), which might create confusion to the
casual Prototype programmer not attracted to reading the source code.

Again, I may be missing the real reason to this.

If possible, I would advise for a more unified interface.

I'm currently working at it through subclassing Ajax.Request in an
attempt not to modify the actual Prototype source code.

I would prefer to slightly modify the actual implementation, if
necessary and advisable, and offer my help for this.

Cheers,

Franck PORCHER


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to