views:

687

answers:

1
+1  Q: 

jQuery and MSXML

MSXML6 is supposed to have the best security, performance, reliability, and W3C conformance (Using the right version of MSXML in Internet Explorer).

Questions:

  1. Why does not jQuery use MSXML6?
  2. Does jQuery use MSXML3? (I think the answer is yes, see my update below...)
  3. Can i fetch the version of MSXML from an IXMLDOMDocument instance? If so, how?

Update:

I've made some research based on Deviant's answer:

jQuery creates the IXMLHTTPRequest object, which was first released with MSXML 2.0, like this:

new ActiveXObject("Microsoft.XMLHTTP");

Microsoft.XMLHTTP is a ProgID, which is only implemented in MSXML3 for legacy support and not recommended. If i understand the reference correctly this would have created a version 2.x IXMLHTTPRequest object, before those versions was “kill-bitted”. Now I'm pretty sure this ProgID creates an MSXML 3.0 IXMLHTTPRequest object. This may answer my second question.

Here is sample code that shows how to create the two recommended versions of the IXMLHTTPRequest object:

new ActiveXObject("MSXML2.XMLHTTP.3.0"); // MSXML 3.0 ProgID...
new ActiveXObject("MSXML2.XMLHTTP.6.0"); // MSXML 6.0 ProgID...

I've tested XSLT performance in MSXML3 vs MSXML6. MSXML6 used less than 1/10 of the time to do the same transformation as MSXML3 for a pretty large XML file!

Rerences:

  1. jQuery: The Write Less, Do More, JavaScript Library
  2. IXMLHTTPRequest
  3. MSXML API History
  4. GUID and ProgID Information
  5. Using the right version of MSXML in Internet Explorer
  6. MSXML 3.0 GUIDs and ProgIDs
  7. MSXML 6.0 GUIDs and ProgIDs
  8. Why Version-Independent GUIDs and ProgIDs Were Removed
+6  A: 

jQuery does. Source:

// Create the request object; Microsoft failed to properly
// implement the XMLHttpRequest in IE7, so we use the ActiveXObject when it is available
// This function can be overriden by calling jQuery.ajaxSetup
xhr:function(){
     return window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
},

But it obviously can't use MSXML in Firefox/chrome/safari/opera etc. So if you attempt to use MSXML in your html your site will only work in IE. So I do not recommend you do that.

jQuery only uses MSXML as a backup to get around the bugs in MS's implementation of XmlHttpRequest.

I wouldn't say that MSXML is the most conformant to the XMLHttpRequest standard. MSXML existed long before XMLHttpRequest did so it's an odd comparison. http://www.w3.org/TR/XMLHttpRequest/

jQuery used to support XML and XPath selectors but that has been deprecated. There are plugins for jQuery and XML http://plugins.jquery.com/search/node/xml+type:project_project

JSON is usually preferred over XML. http://json.org

Chad Grant
IXMLHTTPRequest is part of MSXML
knut
@knut he changed his question, so my answer is off
Chad Grant
IXMLHTTPRequest is an interface in the Microsoft XML Lib, that has nothing to do with the Web Browser DOM object XMLHttpRequest that I linked in my answer. Your question is pretty broad and vague. What are you trying to accomplish? XML/XSLT vs jQuery/JSON ? jQuery/JSON is the obvious choice.
Chad Grant