W3C home > Mailing lists > Public > public-webapi@w3.org > March 2007

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

From: Anne van Kesteren <annevk@opera.com>
Date: Fri, 09 Mar 2007 17:43:29 +0100
To: "Geoffrey Garen" <ggaren@apple.com>, public-webapi@w3.org
Message-ID: <op.toxkqrhr64w2qv@id-c0020.driveway.uu.nl>

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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 8 January 2008 14:18:57 GMT