Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

Incorrect state values for XMLHttpRequest

#106

Fixed in commit http://github.com/thatcher/env-js/commit/2cc8e59da146072ba79c5a07cc...
Please close

regarding XMLHttpRequest.js

// it would be nice if these were part of the standard but                                                                                       
// they are not.                                                                                                                                 
XMLHttpRequest.UNSENT = 0;
XMLHttpRequest.OPEN = 0;
XMLHttpRequest.HEADERS_RECEIVED = 0;
XMLHttpRequest.LOADING = 0;
XMLHttpRequest.DONE = 4;

True they not in the spec as pure javascript values. Safari/Chrome does expose them as

XMLHttpRequest.UNSENT = 0;
XMLHttpRequest.OPEN = 1;
XMLHttpRequest.HEADERS_RECEIVED = 2;
XMLHttpRequest.LOADING = 3;
XMLHttpRequest.DONE = 4;

. Firefox does not, IE don't know. Certainly have envjs.org defining the first four to be "0" seems odd. (And using them in the code would make it more readable).

The following micro script might be useful for testing

<html><head><title>XMLHttpRequest</title></head><body>
<pre><script type="text/javascript">
var x= new XMLHttpRequest();
for (var i in x) {
 document.write(i + ": " + x[i] + "\n");
}
</script></pre></body></html>


The spec http://www.w3.org/TR/XMLHttpRequest/ says:

// states const unsigned short UNSENT = 0; const unsigned short OPENED = 1; const unsigned short HEADERS_RECEIVED = 2; const unsigned short LOADING = 3; const unsigned short DONE = 4; readonly attribute unsigned short readyState;


Reported by nickg · March 15th, 2010 @ 07:20 AM

State: resolved
Milestone: 1.2.x
Assigned to: Thatcher Thatcher

Activity

  1. nickg
    nickg
    • Assigned user set to Thatcher

    giving to thatcher to close out

    March 16th, 2010 @ 07:14 PM

  2. Thatcher
    Thatcher
    • State changed from new to resolved
    • Tag set to constants, xhr, xmlhttprequest
    • Milestone set to 1.2.x

    March 17th, 2010 @ 03:04 AM

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.