IE9 DOMParser is missing method selectSingleNode, selectNodes (and possibly others too …), a solution … (XMLSerializer missing methods also)

When you have browsers which have the DOMParser (like chrome, firefox etc.)
you can do the following in javascript:

var dom = (new DOMParser).parseFromString(str, "text/xml");
dom.selectSingleNode(...);
//etc.

In IE9 although DOMParser is available it seems that it lacks some methods, so you get errors like:
Object doesn’t support property or method ‘selectSingleNode’

The solution you can use in javascript level is something like that:

var dom = new ActiveXObject("Microsoft.XMLDOM");
dom.loadXML(str);
dom.selectSingleNode(...);
//etc.

To all of you who are using sarissa.js and you face the same problems then you need a little code tweaking for it to work. I will share what i did and worked for me. I don’t know if some other parts of the library require also fixing…

in sarissa.js at line 474 (file version 0.9.9.5) replace the line:

if(!window.DOMParser){

with:

if(!window.DOMParser || navigator.userAgent.indexOf("MSIE 9")>-1){

PS. In addition the case with XMLSerializer is the same like DOMParser. So in sarissa.js change the line 596 from:

if(!window.XMLSerializer && Sarissa.getDomDocument && Sarissa.getDomDocument("","foo", null).xml){

to:

if((!window.XMLSerializer && Sarissa.getDomDocument && Sarissa.getDomDocument("","foo", null).xml) || navigator.userAgent.indexOf("MSIE 9")>-1){

That’s all for now.
Cheers.