Re: XPath and find/findAll methods

On Tue 22 Nov 2011 01:05:18 PM CET, Simon Pieters wrote:
> On Mon, 21 Nov 2011 20:34:14 +0100, Martin Kadlec 
> <bs-harou@myopera.com> wrote:
>
>> Hello everyone,
>> I've noticed that the find/findAll methods are currently being 
>> discussed and there is one thing that might be a good idea to consider.
>>
>> Currently, it's quite uncomfortable to use XPath in javascript. The 
>> document.evalute method has lots of arguments and we have to remember 
>> plenty of constants to make it work. IE and Opera support selectNodes 
>> method on NodePrototype, which is really useful, but what's the point 
>> in using it when it doesn't work in FF/Chrome/Safari.
>
> Maybe FF/Chrome/Safari should add support for selectNodes?
>

Right, one of the issues with XPath is that the DOM3 XPath API is 
without doubt the worst API on the web platform. With a sane API there 
might be more demand for XPath since it can be used for things that the 
CSSWG are unlikely to ever allow in selectors for performance reasons. 
As Simon points out, there is even a preexisting API that does more or 
less the right thing and is implemented in IE and Opera.

Received on Tuesday, 22 November 2011 12:16:55 UTC