An XPathExpression is a compiled XPath query returned from document.createExpression(). It has a method evaluate() which can be used to execute the compiled XPath.
Methods
XPathExpression.evaluate()- provide a context node/document,
XPathResultconstant, andXPathResultto store the query or null to return a new XPathResult. XPathExpression.evaluateWithContext()- provide a context node/document, context position, context size,
XPathResultconstant, andXPathResultto store the query or null to return a new XPathResult.
Browser compatibility
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
| Feature | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari |
|---|---|---|---|---|---|---|
| Basic support | Yes | ? | Yes | ? | Yes | ? |
evaluate | Yes | ? | Yes | ? | Yes | ? |
| Feature | Android webview | Chrome for Android | Edge mobile | Firefox for Android | Opera Android | iOS Safari | Samsung Internet |
|---|---|---|---|---|---|---|---|
| Basic support | ? | Yes | ? | Yes | Yes | ? | Yes |
evaluate | ? | Yes | ? | Yes | Yes | ? | Yes |