Re: Behavior of matches() and closest() with :scope()
"Tab Atkins Jr." <[email protected]>
| Newsgroups | gmane.comp.web.dom.general,gmane.comp.web.css.general |
|---|---|
| Message-ID | <CAAWBYDBUV-5j9mrn-gujRV0BS4DD7e0MTq+di9R7ODCvRxahMw@mail.gmail.com> |
On Tue, Sep 2, 2014 at 9:07 AM, Anne van Kesteren <[email protected]> wrote: > On Tue, Sep 2, 2014 at 6:00 PM, Boris Zbarsky <[email protected]> wrote: >> I'd like to be clear on what the proposal is for closest(). Is it: >> >> 1) Pass the element that closest() was called on as the :scope elements >> argument to all the calls up the parent chain. >> >> or >> >> 2) Pass the element that you're matchign against as the :scope elements >> argument. >> >> ? #2 is what you get if you desugar closest() in terms of matches(), but #1 >> seems to be closer to the use case Tab is thinking of, right? > > 1) makes the most sense to me and what I was planning on going with. > But yes, polyfilling would become harder. #1 is what I was intending, but looking at closest() now, I don't see a restriction to just compound selectors. If complex selectors are allowed, then I guess it makes more sense to match matches() and have :scope refer to the element you're matching against. It makes it harder to do some things, but they're probably rare and can be handled explicitly anyway. ~TJ