Re: XPath and find/findAll methods

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