Re: [XMLHttpRequest] readyState values should be available as named constants of the XMLHttpRequest constructor

On Tue, 06 Mar 2007 23:23:20 +0100, Geoffrey Garen <ggaren@apple.com>  
wrote:
> I would like to suggest making the canonical readyState values available  
> as named constants of the XMLHttpRequest constructor, like so
>
>       0 UninitializedReadyState
>       1 OpenReadyState
>       2 SentReadyState
>       3 ReceivingReadyState
>       4 LoadedReadyState
>
> This code
>
>       if (request.readyState == XMLHttpRequest.OpenReadyState) { ... }
>
> is more readable to me that this code
>
>       if (request.readyState == 1) { ... }
>
> which uses a magic number. The DOM 3 APIs tend to use named constants  
> like this.

Some initial drafts used to have this and it was removed because of  
comments, iirc, from Maciej among other people. If enough authors and  
implementors support this idea though I suppose we can reconsider that.  
Anyone?


-- 
Anne van Kesteren
<http://annevankesteren.nl/>
<http://www.opera.com/>

Received on Friday, 9 March 2007 16:43:36 UTC