XPathJS – JavaScript-Based XPath Library

XPathJS is a brand new implementation of XPath 1.0 and DOM Level 3 XPath specifications written in JavaScript. The coolest part is that it supports all the major browsers out there and it comes with unit tests that ensure that every feature conforms fully to the specifications.

 

Features

  • Supports IE6+, Chrome, Firefox, Safari, and Opera
  • Easy to include and initialize in any web project (a single JS file with no dependencies!)
  • Provides namespace support on any HTML page regardless of content type
  • Follows XPath standards rigorously
  • Easily extensible

Usage

For information of usage and latest code please read more about XPathJS on GitHub.

 

So how did XPathJS come to be?

Well originally we were looking for an implementation of a cross-browser XForms solution in hopes to alleviate the pain and complexity that comes with creating normal HTML forms. Unfortunately, we found out that there is neither an XForms engine that is fully implemented, nor does it support all browsers. So we thought, ok let’s try to build our own! Then we realized that XForms makes extensive use of XPath. And again, we could not find a fully functional cross-browser XPath implementation. Long story short, that’s how XPathJS was born.

By releasing XPathJS, we hope to help promote the adoption of open standards in the community.

 

License

The library has been released under dual AGPL and commercial licenses in order to allow everyone to be able to try it out and use in their own projects.