W3C home > Mailing lists > Public > www-dom@w3.org > July to September 2014

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

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Tue, 2 Sep 2014 03:04:12 +1000
Message-ID: <CAAWBYDBQ6kQh-45nus3kNiFfq5KGyL+Q_ZQKrGRW08uJ2yohLQ@mail.gmail.com>
To: Anne van Kesteren <annevk@annevk.nl>
Cc: "www-style@w3.org" <www-style@w3.org>, "www-dom@w3.org" <www-dom@w3.org>, Boris Zbarsky <bzbarsky@mit.edu>, David Håsäther <hasather@gmail.com>
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

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:37:05 UTC