When we see conformance chart, such as https://caniuse.com/#search=xpath and https://developer.microsoft.com/en-us/microsoft-edge/platform/status/domlevel3xpath/?q=xpath, it's usually about DOM Level 3 XPath that focuses on accessing DOM object using XPath 1.0, but not necessarily XPath 3.0 or higher.
Question 1 - Is there any explicit version requirement for browsers by W3C etc. to support newer versions of XPath?
This XPath 1.0 feature works:
document.evaluate(
'normalize-space(" X ")',
document, null, XPathResult.ANY_TYPE, null ).stringValue
// => "X"
But this XPath 3.0 inline-function feature (ref) throws:
document.evaluate(
'let $incr := function($n as xs:integer) as xs:integer { $n +1 } return $incr(2)',
document, null, XPathResult.ANY_TYPE, null ).stringValue
Edge:
XPATH15001: XPath query "let $incr := function($n as xs:integer) as xs:integer { $n +1 } return $incr(2)" not supported
Firefox:
SyntaxError: The expression is not a legal expression.
Question 2 - If XPath 3.0 is allowed in browser, assuming bug in my code; then how about v3.1 features (such as arrow-functions), are those also allowed?