W3C home > Mailing lists > Public > public-webapps@w3.org > October to December 2011

Re: XPath and find/findAll methods

From: Robin Berjon <robin@berjon.com>
Date: Wed, 23 Nov 2011 11:33:20 +0100
Cc: public-webapps WG <public-webapps@w3.org>
Message-Id: <A3B4E39D-FC0D-4DC9-BBAF-A99D3EF58997@berjon.com>
To: Yehuda Katz <wycats@gmail.com>
On Nov 23, 2011, at 01:20 , Yehuda Katz wrote:
> //div[count(.//span) > 6][count(.//span[@data-foo = ../@data-bar]) mod 2 = 1]
> 
> The flip side of this is representing certain common HTML idioms in XPath (like "find me an element with the class 'foo'" or even "find me an element with the class 'foo' that is an already-visited link").

If we really wanted to make that possible, it would not be a huge change. A long time ago I put together "SVG Extensions to XPath" (sadly now lost) that could do things like select elements inside a given bounding box. Adding support for class and visited is easy, and readily doable given that the extensibility door is open. But I don't think that anyone's interested. The idea is to make more elaborate tree walking that's faster than doing it in JS. No one (that I know of) has replacing CSS in mind  that would just be silly.

-- 
Robin Berjon - http://berjon.com/ - @robinberjon
Received on Wednesday, 23 November 2011 10:34:05 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:49 GMT