A pure JavaScript implementation and shim for the DOM Level 3 XPath specification.
<!DOCTYPE html>
<html>
<head>
<script src="xpath-dom.shim.min.js"></script>
<script>
document.evaluate("//*", document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE);
</script>
</head>
</html>
It works perfectly well together with jsdom.
var XPathEvaluator = require("xpath-dom");
XPathEvaluator.evaluate("//*", document, null, XPath.XPathResult.ORDERED_NODE_SNAPSHOT_TYPE);
-
Namespaces are not yet supported.
-
The
lang()
function is not yet implemented. -
The
namespace-uri()
function is not yet implemented.