This method compiles an XPathExpression
which can then be used for (repeated) evaluations.
Syntax
xpathExpr = document.createExpression(xpathText, namespaceURLMapper);
Parameters
- xpathText is a string which is the XPath expression to be compiled.
- namespaceURLMapper is a function which maps a namespace prefix to a namespace URL (or null if none needed).
Firefox 3 note
Prior to Firefox 3, you could call this method on documents other than the one you planned to run the XPath against. Under Firefox 3, you must call it on the same document.
Return value
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.
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
createExpression | Chrome Full support 1 | Edge Full support 12 | Firefox Full support Yes | IE ? | Opera ? | Safari ? | WebView Android Full support Yes | Chrome Android Full support Yes | Firefox Android Full support Yes | Opera Android ? | Safari iOS ? | Samsung Internet Android Full support Yes |
Legend
- Full support
- Full support
- Compatibility unknown
- Compatibility unknown