Re: Behavior of matches() and closest() with :scope()

On Tue, Sep 2, 2014 at 2:48 AM, Anne van Kesteren <annevk@annevk.nl> wrote:
> In https://bugzilla.mozilla.org/show_bug.cgi?id=886308#c29 bz points
> out that I introduced a regression relative to the old definition of
> matches() with the new hook in Selectors.
>
> I guess the way to fix this for matches() would be to add a :scope
> elements argument.

You're just referring to the internal ":scope elements" arg for the
matching algo, right?  Not adding an argument to matches()?  If so,
then yes, just passing the element as the sole :scope element will
work fine.

> What about closest(), should it have that argument
> too?

Yes, go ahead and do so.  While it's not usually going to be useful
(as the argument to closest() is a compound selector matched against
the element's ancestors), it could be used in a :has() pseudo.

~TJ

Received on Monday, 1 September 2014 17:05:00 UTC