On Tue, 19 Sep 2006 14:01:41 -0000, Alexey Proskuryakov
<[EMAIL PROTECTED]> wrote:
I have tried searching the archives, but couldn't find this already
discussed.
The specification defines states 1 and 2 as:
1 Open. The open() method has been successfully called.
2 Sent. The UA successfully completed the request, but no data has yet
been
received.
For async requests, send() MUST return immediately, i.e. even before
resolving the hostname. However, it is also specified that the state
MUST be
set to Sent, which apparently violates its definition.
In my tests, WinIE 6, Firefox 1.5 and Safari 2 all do not change
readyState in an async send(). This effectively means that state Open is
followed by an additional pseudo-state with the same numerical value
(e.g.,
Safari currently ignores subsequent send() requests).
So one way of doing it would be that after the request is completed you go
to 2, then quickly to 3 and even quicker to 4 dispatching readystatechange
in the process. Another way of doing it would be to go directly to 4 for
async requests and dispatch readystatechange when going from 1 to 4.
The people I talked to about this feel that doing the latter makes more
sense and I tend to agree. It also means you can easily switch between
async and sync requests.
--
Anne van Kesteren
<http://annevankesteren.nl/>
<http://www.opera.com/>