I am doing a lot of XPath with “normal & modern” browser (FF, Chrome, Opera, Safari…) but I’m looking for a javascript library which allow IE to support document.evaluate() method.
Does it exist ? I know there are some similar questions in StackOverflow, but they were asked & answered many years ago.
The idea is to: factorize the code in reading xpath & also producing (same) xpath.
Update, 8th August 2011:
I find the lib proposed by @ExtremeCoder here : http://sourceforge.net/projects/html-xpath/
This is really what I need (it “override” document.evaluate only for IE)… but it creates bug on chrome & it doesn’t work more on IE :/
Update 29 August 2012 (yeah, one year after).
I test a wide range of library. A lot of those which override document.evaluate are not very strong or suffer for different bugs.
I finally use the good old Google Ajax XSLT without the XSLT part 😉
http://goog-ajaxslt.sourceforge.net/
(so I validate your answer @Cheeso)
By the way a lot of (or all) these libraries are not anymore maintained.
Update again, 28th September 2012:
Google starts another XPath lib project.
I dont test it yet but it seems promising and updated.
http://code.google.com/p/wicked-good-xpath/
As usual, thanks Microsoft (for explorer 8/9/10) (sic!), please learn to support basic standards and other browsers behaviors.
This is what I use:
You can use the same code in all browsers, though it is not
document.evaluate(), not directly. Instead you use it like this: