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

Re: XPath and find/findAll methods

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Tue, 22 Nov 2011 08:07:56 -0500
Message-ID: <4ECB9EAC.20403@mit.edu>
To: public-webapps@w3.org
On 11/22/11 7:31 AM, Martin Kadlec (BS-Harou) wrote:
> CSS: "article>  div:nth-child(2) input[type=text], article>  div:nth-child(2) input:not([type]), article>  div:nth-child(2) input[type=color]";
> XPath: "//article/div[2]//input[@type='text' | @type='color'| not(@type)]";

How about:

CSS:

   "article > div:nth-child(2) input:any([type=text], :not([type]), 
[type=color])"

(modulo the continuing bikeshedding about calling it :any vs :matches)? 
  I fully expect this to be available before any sort of XPath changes 
in UAs.

> 2) It's impossible to write the CSS selector (or really really hard/long)
> a - "*[@data-price>30]";
> b - "*[position()<30]";
> c - "div[@*]";
> d - "//div[parent::*//a]";

Indeed.  This seems to be the primary use case for XPath.

-Boris
Received on Tuesday, 22 November 2011 13:08:38 GMT

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