title: Can IE manipulate XML using jQuery?
body: <p><strong>What I am not trying to do:</strong></p>
  
  <ul>
  <li>Simply "read" XML in IE using jQuery. Been there, done that. Works for the most part.</li>
  <li>Load XML via AJAX. This is a legacy system using XML in a hidden field (oh yah, baby!) between postbacks to store a wizard data structure. Rewriting it would suck.</li>
  </ul>
  
  <p><strong>What I am trying to do:</strong></p>
  
  <ul>
  <li><em>Manipulate</em> the XML document using jQuery in IE</li>
  <li>Use the same code across all browsers, using the native jQuery functionality</li>
  </ul>
  
  <p><strong>What I would be okay with:</strong></p>
  
  <ul>
  <li>Overriding/overloading the same jquery methods to get them to work in IE when manipulating the XML DOM.</li>
  </ul>
  
  <p>It just doesn't work and I feel like it just isn't possible in a 100% cross browser way using plain old jQuery methods.</p>
  
  <p>Case in point:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
      &lt;title&gt;IE Sucks&lt;/title&gt;
      &lt;script src="Scripts/jquery-1.5.min.js" type="text/javascript"&gt;&lt;/script&gt;
      &lt;script type="text/javascript"&gt;
          var xml =
              '&lt;Browsers&gt;' +
                  '&lt;CoolBrowsers&gt;' +
                      '&lt;Browser name="Opera"&gt;&lt;/Browser&gt;' +
                      '&lt;Browser name="Chrome"&gt;&lt;/Browser&gt;' +
                      '&lt;Browser name="Firefox"&gt;&lt;/Browser&gt;' +
                  '&lt;/CoolBrowsers&gt;' +
                  '&lt;BadBrowsers&gt;' +
                      '&lt;Browser name="IE6"&gt;&lt;/Browser&gt;' +
                  '&lt;/BadBrowsers&gt;' +
              '&lt;/Browsers&gt;';
  
          $(function () {
  
              $("#xml").text(xml);
  
              var uncoolBrowser = $("&lt;Browser /&gt;").attr("name", "IE7");
  
              // In 1.5, using this...
              var $xml = $($.parseXML(xml));
  
              // Nope. Works everywhere else, though!
              // var $xml = $(xml);     
  
  
              // Throws a "Type mismatch"
              // Works everywhere except IE
              // This is case sensitive (??? WTF ???)
              // Lowercase "badbrowsers" nothing happens
              // Uppercase "BADBROWSERS" nothing happens
              // Best part? $xml.find("BadBrowsers").length === 1
              $xml.find("BadBrowsers").append(uncoolBrowser);
  
              // Only way to output XML in IE
              $("#result").text($xml[0].xml);
  
              // Fuggetaboutit
              // Technically, it does work in IE but not when using $.parseXML()
              // $("#result").text($("&lt;div&gt;&lt;/div&gt;").append($xml.clone()).html());
          });
      &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;pre id="xml"&gt;&lt;/pre&gt;
      &lt;pre id="result"&gt;&lt;/pre&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Is it possible? Can this simple scenario be done or has IE just forsaken us all? <code>$(xml).everything</code>, etc. works in FF, Opera, Chrome, and Safari.</p>
  
  <p><strong>Update</strong></p>
  
  <p><strong>It is possible using voodoo magicks.</strong></p>
  
  <p>I've <a href="https://github.com/kamranayub/jQuery-XML-Helper" rel="nofollow">created a jQuery plugin</a> that takes care of reconciling the differences between different browser handling of XML. I also made an <code>.xml()</code> function based on similar code elsewhere, though mine fixes an IE-only issue. This works in all browsers, IE7 &amp; IE8 for sure, can't test IE6.</p>
  
  <p>I have posted this on my github. If anyone has suggestions or improvements, let me know. There are several things I've already run into but I have been fixing them as I run into them.</p>