Re: QSA, the problem with ":scope", and naming

On Thu, Nov 10, 2011 at 11:33 PM, Jonas Sicking <jonas@sicking.cc> wrote:
> On Thu, Nov 10, 2011 at 2:57 PM, Travis Leithead
> <travis.leithead@microsoft.com> wrote:
>> This has been an interesting debate, but I'm still a little confused with the outcome (if any).
>>
>> Will someone summarize the current position on these issues:
>>
>> 1. Should "find()" and "findAll()" follow <style scoped> rules or not and how?
>
> While related, I think the question of how <style scoped> rules are
> parsed is somewhat independent.
>
>> 2. How does the presence of ":scope" affect "find()" and "findAll()"
>> 3. Should "invalid" selectors be allowed (those that start with a combinator)? (I'm not quite sure where that landed)
>
> Here is my detailed proposal based on the previous thread for how
> selector parsing should work in the context of .find/.findAll:
>
> 1. Start with an empty list
> 2. Skip any whitespace at the beginning of the string.
> 3. If the next character is a ">", a "+" or a "~", insert a "simple
> selector"[1] containing just the ":scope" pseudo selector at the
> beginning of the selector.
> 4. Parse as a "selector"[1]. If there's a parse error throw an
> SyntaxError exception.
> 5. If during parsing a ":scope" pseudo class was parsed, and if a
> ":scope" pseudo selector was added in step 2, throw a SyntaxError
> exception.
> 6. If during parsing no ":scope" pseudo class was parsed, and if no
> ":scope" pseudo selector was added in step 2, add a simple selector
> containing just the ":scope" pseudo class to the beginning of the
> list, and use a descendant selector as combinator to the rest of the
> selector.
> 7. Add selector to the end of list created in step 1.
> 8. If, after skipping any whitespace, the next character is a comma,
> skip the comma and go to step 2.
>
> The resulting selector list is evaluated against the document node,
> but with :scope matching the node that .find/.findAll was called on.
> .findAll returns all nodes which match the selector in document order.
> .find returns the first node in the list of nodes that .findAll
> returns, or null if the list is empty.
>
> Now, as for what type .findAll should return is a so far unresolved
> question. I'll start a separate thread on that.

And I forgot to include:

[1] as defined by the Selector spec.

/ Jonas

Received on Friday, 11 November 2011 07:35:51 UTC