Re: XPath and find/findAll methods

On 11/22/11 2:38 PM, Robin Berjon wrote:
> On Nov 22, 2011, at 18:31 , Boris Zbarsky wrote:
>> On 11/22/11 12:29 PM, Robin Berjon wrote:
>>>>> d - "//div[parent::*//a]";
>>>>
>>>> (d) can be done with the new subject indicator in the Selectors 4
>>>> draft:   a!>   div  (syntax pending, but that's the general idea)
>>>
>>> I think that the example you show selects the<a>   parent of a<div>, not<div>s that have parents containing an<a>.
>>
>> Yes, that's what Tab's selector selects too.  The '!' after the 'a' is important there.
>
> Wait, I thought I'd grasped the gist of S4 but now you're confusing me :) My reading of Tab's selector is that it
> matches the<a>  in<a><div/></a>.

Yep.  I'd misread your mail as saying that's what you wanted to match...

> What Martin's XPath matches is the<div>  in<section><div/><p><a/></p></section>  (amongst many other variants). It's "all div's whose parents have an a descendent".

Ah, ok.  Yeah, no way to do that in Selectors yet.

-Boris

Received on Tuesday, 22 November 2011 22:43:09 UTC