Re: Remaining Problems with Explicit :scope Switching in find/findAll

Yehuda Katz
(ph) 718.877.1325


On Fri, Nov 25, 2011 at 1:42 PM, Sean Hogan <shogun70@westnet.com.au> wrote:

>  On 25/11/11 5:53 AM, Yehuda Katz wrote:
>
>
>  So, the rules end up being very simple.  find always evaluates against
>> the whole document.  If one of the selectors starts with a combinator
>> or doesn't contain a ":scope" pseudoclass somewhere in it, ":scope" is
>> prepended to it.  That's it.  With this, we make the most common cases
>> (searching descendants/siblings) easy, while making the global case
>> *also* easy.  There's a bit of intent-guessing when :scope is used in
>> an indirect way, but I believe it's better to err on the side of
>> simplicity and consistency there.
>>
>
>  I am ok with this, but I am also ok with "find always evaluates
> against the whole document.  If one of the selectors doesn't contain a
> ":scope" pseudoclass somewhere in it, ":scope" is prepended to it."
>
>  I also thing we agreed that filtering selectors, in the case of implicit
> scope, are applied on the :scope, not as a descendent of the :scope.
>
>  As I said above, since the cases of starting with a combinator are
> nonsense queries (correct me if I'm missing something obvious), we can
> simplify the rules even more and eliminate the case of "starting with a
> combinator *and* has a :scope"
>
>
> Are you AGAINST findAll() always implying :scope at the start of each
> selector in a selector list, and leaving explicit :scope to
> querySelectorAll()?
>

I consider querySelectorAll to have mostly broken semantics, and having two
APIs that do (roughly) the same thing except for a few caveats is just
going to cause more confusion. If findAll was essentially a semantic
cleanup of querySelectorAll, including the new explicit :scope behavior, we
could just say "querySelectorAll had some problems; everyone use findAll
now".


>
> If so, why?
>
> Sean
>
>

Received on Friday, 25 November 2011 22:16:23 UTC