Re: Selectors: hooks needed by DOM

On Thu, Sep 12, 2013 at 7:40 AM, Anne van Kesteren <annevk@annevk.nl> wrote:
> http://dom.spec.whatwg.org/ now defines the "Selectors API", i.e. the
> query/queryAll/querySelector/querySelectorAll methods and a new
> Elements object that has query/queryAll.
>
> I found the need for these hooks:
>
> 1) Parsing a selectors string and that either returning an opaque
> representation of selectors or failure.
>
> 2) Parsing a relative selectors string against an
> Element/Document/DocumentFragment node or set of Element nodes and
> that either returning an opaque representation of selectors or
> failure.
>
> 3) Matching an opaque representation of selectors against a tree using
> a scoping root Element/Document/DocumentFragment node.
>
> I implement additional logic on top of 3) in
> http://dom.spec.whatwg.org/#evaluate-a-relative-selectors-string and
> this leads me to thinking that if you want to define that logic we
> could instead define matching as an opaque representation of selectors
> against an Element/Document/DocumentFragment node or set of Element
> nodes. Because if you have the selectors and the node or set of nodes,
> you can find the tree(s) and do all the work. Let me know how you'd
> prefer to organize this.

All right, I think I've defined everything you need:
<http://dev.w3.org/csswg/selectors/#api-hooks>

Let me know if something is missing or clumsy, and I'll try to adjust.

~TJ

Received on Monday, 30 September 2013 23:43:32 UTC