This method compiles an XPathExpression
which can then be used for (repeated) evaluations.
xpathExpr = document.createExpression(xpathText, namespaceURLMapper);
xpathText
(the XPath expression to be compiled)namespaceURLMapper
(maps a namespace prefix to a namespace URL (or null if none needed))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.
Desktop | ||||||
---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | |
Basic support | Yes | ? | Yes | ? | ? | ? |
Mobile | |||||||
---|---|---|---|---|---|---|---|
Android webview | Chrome for Android | Edge Mobile | Firefox for Android | Opera for Android | iOS Safari | Samsung Internet | |
Basic support | Yes | Yes | ? | Yes | ? | ? | ? |
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/document/createExpression