When I run it in the console I should see the ajax object with readyState as 0 (which is right cause I aborted the ajax call) and after that I should of course see a 0 too cause I am just retrieving a property of the previous object. However Chrome is displaying in the console the number 4 instead of 0! This is unbelievable.
temp = new XMLHttpRequest();
temp.open("POST","http://jsfiddle.net/",true);
temp.onreadystatechange = function() {
console.log(temp);
console.log(temp.readyState);
};
temp.send(null);
temp.abort();
Does anyone knows how to fix this problem in Chrome? I will report this bug to them but I would like someone here smarter than I to take a close look and tell me if this is really a bug.
--
IF ANYONE is smart read this:
It looks like nobody read my question.
temp = new XMLHttpRequest();
temp.open("POST","http://jsfiddle.net/",true);
temp.onreadystatechange = function() {
console.log(temp);
console.log(temp.readyState);
};
temp.send(null);
temp.abort(); WHY in the first line of the console the object temp has readyState property set to 0 and in the second line of console temp.readyState shows 4? Both should be the same, despite any browser particular behaviour.
If an object has a property xxx set to 0 then object.xxx MUST be 0 not 4 as my example shows this bug.