[Javascript] Firefox 1.5+ and Ajax responses
Nick Fitzsimons
nick at nickfitz.co.uk
Mon Oct 2 10:18:12 CDT 2006
On 2 Oct 2006, at 15:04, Bosky, Dave wrote:
> Is Firefox case-sensitive? "request.readystate" works fine in Internet
> Explorer.
> ~Dave
>
ECMAScript, of which JavaScript is an implementation, is case-
sensitive. Internet Explorer also allows the use of VBScript, which
is based on Visual Basic, and is case-insensitive.
XMLHttpRequest on IE (before version 7) is implemented as a COM
control (also known as an ActiveX Control), and can be used from
VBScript and Visual Basic (as well as other programming
environments). Therefore, in common with other scriptable components,
it has to allow case-insensitive access to its properties, or it
would appear that some parts of Visual Basic were case-insensitive
while other parts were not.
But the readyState property is given in that form (with the capital
S) in Microsoft's documentation, and that is how it should be
referenced in ECMAScript languages such as JavaScript. (Internet
Explorer uses JScript, which is a "close but no cigar" implementation
of ECMAScript.)
Basically, the case-insensitivity you have come across is the legacy
of a decision by the designers of Visual Basic not to force lazy
programmers to use the shift key, compounded by the battle for market
dominance between Netscape Navigator 3 and Internet Explorer 3 back
in 1997. It's best to use the form of capitalisation in Microsoft's
own documentation, as that is what has now been taken forward into
the W3C's draft specification of XMLHttpRequest.
Finally, IE 7 has native support for XMLHttpRequest and a quick test
shows that its readyState property is case sensitive, as originally
specified, and as implemented by all other browsers. Once again, the
fact that something works with IE 6 just means that IE 6 allows you
to do stuff that shouldn't work :-)
HTH,
Nick.
--
Nick Fitzsimons
http://www.nickfitz.co.uk/
More information about the Javascript
mailing list