What browsers support Xpath 2.0?

后端 未结 4 1840
孤街浪徒
孤街浪徒 2020-12-03 06:48

I have recently been working with XPath and have been searching for information on which browsers support XPath 2.0 without much luck. The best I could find was the query te

4条回答
  •  既然无缘
    2020-12-03 07:39

    There is also Saxon CE, an open-source Javascript implementation of XSLT 2.0. Since XSLT 2.0 includes XPath 2.0, this provides an XPath 2.0 implementation in the browser. However it isn't built-in.

    I just tried the current version of Safari (7.0.6) and it didn't accept the XPath 2.0 functions that I gave it:

    > document.evaluate("starts-with('foo', 'f')", document.documentElement, null,
                     XPathResult.BOOLEAN_TYPE, null);
    < XPathResult
    
    > document.evaluate("ends-with('foo', 'o')", document.documentElement, null,
                     XPathResult.BOOLEAN_TYPE, null);
    < Error: INVALID_EXPRESSION_ERR: DOM XPath Exception 51
    

    So I'd say WebKit (specifically the JS engine, SquirrelFish / Nitro) doesn't currently support XPath 2.0.

    Aug 2020 Update: The current successor to Saxon-CE is Saxon-JS 2, which supports XPath 3.1.

提交回复
热议问题