Note that there are some explanatory texts on larger screens.

plurals
  1. PODOM Level 3 XPath in Internet Explorer
    primarykey
    data
    text
    <p>I just installed IE10 on my Windows 7, and I've noticed that, even if I'm glad that XMLs from AJAX requests are now compatible DOM documents, a rather basic function like <code>document.evaluate</code> is <em>still</em> not supported.</p> <p>What's worse is that, since those XMLs are <em>not</em> the custom Microsoft <code>IXMLDocument</code> objects, the nodes don't support <code>selectNodes</code> and <code>selectSingleNode</code> anymore. <strong>In the end, it seems that IE10 does not support DOM Level 3 XPath or MSXML Xpath.</strong></p> <p>Seriously, Microsoft? Is there something I'm missing?</p> <p>Sure, I can use <code>querySelector</code> and <code>querySelectorAll</code>, but I don't want to lose quite a bit of backward compatibility.</p> <p><strong>Otherwise</strong>, one can still request a MSXML document using this line</p> <pre><code>try {xhr.responseType = "msxml-document";} catch(e) {} </code></pre> <p>as stated <a href="http://blogs.msdn.com/b/ie/archive/2012/07/19/xmlhttprequest-responsexml-in-ie10-release-preview.aspx" rel="noreferrer">here</a>, but I think it would be nice to deal with, at last, a standard DOM document in IE too.</p> <p>So, is there a way to use XPath in IE10 with standard DOM documents?</p> <p><strong>UPDATE 26/7/2013</strong> IE11 isn't stable yet, but it <em>still</em> doesn't support <code>document.evaluate</code>. If it won't support it in the stable release, I doubt it will <em>ever</em> support it. Needless to say this is ridicolous.</p> <p>I get that you can use <code>querySelector</code>/<code>All</code> in DOM nodes, but it's not supported in IE9 and lower, which are still quite commonly used, and anyway XPath is more powerful than selectors.</p> <p>Fortunately (if you can say that), you can still set <code>xhr.responseType = "msxml-document"</code>. For a moment I feared you couldn't do that anymore...</p> <p><strong>UPDATE 23/11/2013</strong> IE11 is stable now but, sadly, it doesn't support <code>document.evaluate</code>. As heavy-weight XML documents are used less and less in web applications in favor of JSON or other light notation formats, this is becoming less of a problem, but still.</p> <p>Setting the <code>responseType</code> property still provides legacy XML documents, so nothing is lost I guess. I don't know if that will stay true for IE12, though.</p> <p><strong>UPDATE 15/8/2015</strong> Sounds ridiculous right now, but Edge now supports <code>document.evaluate</code>. Just when (almost) everything switched to JSON for data exchange. Well, better late than never, I guess.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload