Re: [selectors] Assistance requested in figuring out the data model of pseudo-elements

On Tue, Nov 25, 2014 at 1:44 PM, Benjamin Poulain <benjamin@webkit.org> wrote:
>> If we do this, then my example of the just world would work, and I
>> wouldn't have to explain why one kinda-combinator is allowed in
>> :matches() but no other, and why the order of selectors matters if
>> :matches() contains a pseudo-element.
>
> I am confused with this last paragraph. Aren't all combinators already
> allowed in :matches()?
>
> The definition says the argument is simply a selector list. WebKit allows
> any combinator in :matches(). Using combinators in :matches() is super
> useful, we already use that a lot.

Yes, but the subject of the matches is the last thing in each complex
selector; in `a:matches(b > .foo)`, the ".foo" element has to be the
same as the "a" element; the "b" element is an ancestor.  In
`a:matches(::before)`, though, that's not the intent - the ::before is
*not* the same as the "a" element, it's a sub-element(ish).

This is why I'm talking about making :: actually a combinator, into
the pseudo-tree.  Then you can switch the match set to be the
pseudo-elements of an element, before trying to match :matches()
against it.

~TJ

Received on Tuesday, 25 November 2014 22:32:41 UTC