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

Hi folks.

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.

Thanks,
Geoff Garen

Received on Wednesday, 7 March 2007 05:02:16 UTC