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 UTC

This archive was generated by hypermail 2.3.1 : Friday, 27 October 2017 07:26:37 UTC