- From: James Robinson <jamesr@google.com>
- Date: Mon, 21 Nov 2011 14:18:06 -0800
- To: Martin Kadlec <bs-harou@myopera.com>
- Cc: public-webapps@w3.org
- Message-ID: <CAD73md+rGwh1fFsDt-YuD_hcOppSZpLEbuMYdxubteTb+2kPRg@mail.gmail.com>
On Mon, Nov 21, 2011 at 11:34 AM, 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. > XPath is dead on the web. Let's leave it that way. - James > > My idea is to combine querySelector/All and selectNodes methods. This > combination - find/findAll - would make using XPath much easier and it > might give a good reason to lot's of programmers to use it instead of > querySelector/All although it's going to be newer technology. > > The problem is how to combine the methods, because in some cases it might > not be clear if the string is xpath or css query. Because CSS queries are > probably going to be used much more often than xpath it should be easier to > call the method with CSS query. There is an idea I have but I would be glad > for any other. > > findAll(query, use_xpath): > CSS: findAll("nav a:first-child"); > XPATH: findAll("//nav/a[1]", true); > > Cheers, > Martin Kadlec > > >
Received on Monday, 21 November 2011 22:18:52 UTC