Re: Selectors: hooks needed by DOM

On Thu, Mar 20, 2014 at 3:58 AM, Anne van Kesteren <annevk@annevk.nl> wrote:
> On Wed, Mar 19, 2014 at 7:02 PM, Tab Atkins Jr. <jackalmage@gmail.com> wrote:
>> Scope-contained selectors can't match *any part* of their selector
>> outside of the scope.  Absolutizing the selector doesn't help here.
>
> I'm not using scope-contained. Is that for <style scoped>?

Yup.

(We also originally thought it would be useful for .query(), but
realized later that all we wanted was relative selectors and the
:scope pseudo-class.)

> Thanks for your guidance. I think these methods are now correctly
> defined, review welcome:
>
> * http://dom.spec.whatwg.org/#dom-parentnode-query
> * http://dom.spec.whatwg.org/#dom-parentnode-queryselector
> * http://dom.spec.whatwg.org/#dom-element-matches

Yup, they all look correct to me.

I thought querySelector() took additional arguments for setting the
context object?

> Based on this work, I have the following feedback on the Selectors standard:
>
>  * "scoping root" is a defined term, but "scoping method" is not.

Good catch.  I've dfn'd it.

> * I don't understand why there is a specific API-entry point for
> matching selectors against a tree. It seems that should just be one
> algorithm.

I don't understand what you mean.

> * The API-entry point does not explicitly reference the main matching algorithm.

Done.

> * Also, I found the terminology confusing. :scope being determined by
> reference elements rather than the scoping root did not really help.
> Maybe we can name elements matching :scope the ":scope elements"?

Hmm, good idea.  Done.

> Why is it #scope-contained-selectors and #scope-filtered (not
> #scope-filtered-selectors)? I link to #scope-filtered-selectors at the
> moment from DOM as I assumed it was the same...

Because we were strangely inconsistent about whether "selectors" was
inside or outside the <dfn>.  Fixed now - they're both just
"#scope-XXX".

~TJ

Received on Thursday, 20 March 2014 18:14:06 UTC