- // other browsers way
- var xmls = new XMLSerializer;
- var string = xmls.serializeToString(myXMLDocument);
- // Internet Explorer way
- var string = myXMLDocument.xml;
Moreover, document.evaluate is amazing stuff, but the most common call to this function is this one:
- var xpresult = document.evaluate(XPathSelector, myXMLDocument, null, 0 /* as ANY_TYPE */, null);
In internet explorer we have a slightly different function: selectNodes
- var xpresult = myXMLDocument.selectNodes(XPathSelector);
The main difference is number of character used to call the standard method rather than IE one, with a completely equal result during iteration where IE nextNode has the same meaning of other browsers iterateNext. Again, if we are in Internet Explorer we can rely in the most ugly property we have ever seen since first JScript implementation over the DOM: document.all. Now, why on earth we love YUICompressor plus gzip “miniaturization” but we prefer a meaningless syntax like this:
I would love to see us in a world where standards weren’t the only way to innovate deeply in the browser, cross browser. We have add-ons in most browsers, but creating multiple versions is a pain. I was excited about Gears as a way to do cross browser work, and maybe if a Gears-like system that allowed many people to write services, we could go further.
Andrea has also just posted on the vice versa selector performance where it does quite well in slickspeed on FFx 3.