Thanks for your reply. Well, I've read Professional Ajax (several times actually :) and I know the method presented there.
What I'd asked here about wasn't actually a question, rather a statement and I just wanted to hear from authors regarding this subject. To put it more precisely I think that both code snippets in “Try it out” section on page 79 are erroneous because of reasons presented earlier. I could be wrong of course. My apologies if it is the case.
And two additional remarks: probably it is not a good idea to name the method CreateXmlHttpRequestObject(). I don’t think anyone would use such a verbose name in real project. And it also probably not quite accurate to place such method in a global namespace (i.e. declare it globally) so despite of the phrase “The preceding example, which created the XmlHttpRequest object in a cross-browser fashion will be
encapsulated in a function called CreateXmlHttpRequestObject() and included in a script file named
.” this method is not actually encapsulated.