Re: [selectors-api] QSA and findAll definitions

2013-06-09 Thread Boris Zbarsky

On 6/9/13 7:35 PM, Timmy Willison wrote:

I was a little confused. I realized something I already knew in that
elem.querySelector[All] does limit the matched set to the descendants of
element


Right. But find() does not, for what it's worth, depending on the exact 
selector used.  It can return sublings of the context object, for 
example, as far as I can tell.  Hence the wording difference.


-Boris



Re: [selectors-api] QSA and findAll definitions

2013-06-09 Thread Timmy Willison
I was a little confused. I realized something I already knew in that 
elem.querySelector[All] does limit the matched set to the descendants of 
element, but the selector itself is not relative. Sorry about that. 


​I guess my only question now is what is the difference between the way 
.find[All] and .querySelector[All] relate to the context object? Why the 
wording difference?


Thanks again, 


- Timmy

On Sun, Jun 9, 2013 at 5:34 PM, Timmy  wrote:

> The wording of the QSA and findAll definitions are a bit confusing to me. 
> Forgive me if I'm misunderstanding, but the definitions for 
> querySelector[All] and find[All] seem to be partly reversed.
> First, the definition of subtrees seems clear enough:
> "The term subtrees refers to the set of elements that are descendants of the 
> specified context object."
> However, the definition for querySelector currently states: "return the first 
> matching Element node within the subtrees of the context object". Isn't that 
> the definition for find? Element#querySelector does not limit matching to 
> subtrees of the context object. `elem.querySelector("div")` will return all 
> divs on the page, not just descendants of `elem`. I assume this was not meant 
> to be changed here.
> find states: "return the first matching Element node from the tree within 
> which the context object is located". This sounds just like what 
> querySelector is supposed to do. Element#querySelector returns results based 
> off of the tree in which the element is located.
> Thanks,
> - Timmy

[selectors-api] QSA and findAll definitions

2013-06-09 Thread Timmy
The wording of the QSA and findAll definitions are a bit confusing to me. 
Forgive me if I'm misunderstanding, but the definitions for querySelector[All] 
and find[All] seem to be partly reversed.

First, the definition of subtrees seems clear enough:
"The term subtrees refers to the set of elements that are descendants of the 
specified context object."

However, the definition for querySelector currently states: "return the first 
matching Element node within the subtrees of the context object". Isn't that 
the definition for find? Element#querySelector does not limit matching to 
subtrees of the context object. `elem.querySelector("div")` will return all 
divs on the page, not just descendants of `elem`. I assume this was not meant 
to be changed here.

find states: "return the first matching Element node from the tree within which 
the context object is located". This sounds just like what querySelector is 
supposed to do. Element#querySelector returns results based off of the tree in 
which the element is located.

Thanks,

- Timmy