Re: Remaining Problems with Explicit :scope Switching in find/findAll (was: Re: [Selectors API 2] Is matchesSelector stable enough to unprefix in implementations?)

On Thu, Nov 24, 2011 at 10:53 AM, Yehuda Katz <wycats@gmail.com> wrote:
>> > * Is :scope always implied if it begins with an explicit combinator
>> > other
>> > than descendant, even if :scope is used elsewhere?
>> >  find(">div :scope");
>> >  find("+div :scope");
>> >  find("~div :scope");
>>
>> Yes.
>
> I think I would be ok with this case throwing, because all of the cases are
> nonsense queries.

*Those* cases are nonsense.  Use the reference combinator, though, and
it suddenly becomes possibly reasonable.

Alternately, assume that :matches() is eventually changed to allow
complex selectors.  Using :scope there is completely fine.

Rather than trying to carve out some ways that are okay and other ways
that throw, I think it's better to just use the simplest possible
rule: prepend :scope to them and evaluate them as normal.  The
selectors above just won't match anything, is all.

~TJ

Received on Friday, 25 November 2011 02:59:22 UTC