Pure JS implementation of the DOM Level 3 XPath specification
npm install wicked-good-xpath 
html
`
Then call wgxpath.install() from your JavaScript code, which will ensure document.evaluate, the XPath evaluation function, is defined on the window object. To install the library on a different window, pass that window as an argument to the install function.We provide an NPM package at https://www.npmjs.com/package/wicked-good-xpath.
There's also another NPM package at https://www.npmjs.com/package/wgxpath.
Building it Yourself
We use Gulp:
`
npm install
gulp
`
You can also run src/compile.sh` if you want to use different versions ofWhile it was fast, the code fell out of maintenance (last update was in 2007) so bugs were tough to get fixed. Also, since it wasn't written in Google Closure, it was tricky for us Googlers to integrate into our JavaScript applications. A rewrite was necessary.
However, we went beyond merely porting the library to Google Closure and fixing a couple bugs. We identified some significant additional performance improvements, such that our version runs about 30% faster than the original. On top of that, the Closure compiler was able to minify our code down to a mere 25K, 40% smaller than JavaScript-XPath's 42K (though it has grown a bit since). Finally, the code is structured and documented in a way that we believe will make future maintenance quicker and easier.