The document.evaluate() method enables XPath queries to be performed in JavaScript in Web applications and documents. It returns an XPathResult object, with methods that enable iterating through the set of nodes that match the document.evaluate() XPath query.
The MDN Introduction to using XPath in JavaScript article provides a very good overview of how to use document.evaluate()
and how to work with XPathResult
objects.
document.evaluate()
and XPathResult
are part of the DOM3 XPath standard.