Re: [csswg-drafts] [selectors-5] add new selector immediate-adjecent-child

Oh wait, nevermind, I was misreading. They are indeed asking for something larger.

@Meteor0id: Note that "the thing that's like + vs ~, but for children" already exists - it's `>` (versus " ", the descendant combinator).  What you're actually asking for didn't previously have an analog in either siblings *or* children; the new additions to `:nth-child()` do happen to bring this functionality into sibling lists, but we have no such way to search among the descendant list.  This is likely because it is, as @Loirooriol points out, dramatically more expensive to do so, making it somewhat unsuitable for the [live profile](https://drafts.csswg.org/selectors/#live-profile).  This is something you should instead just write a little bit of JS for: a treewalk using [`Element.matches()`](https://dom.spec.whatwg.org/#dom-element-matches) is easy and small to write.

-- 
GitHub Notification of comment by tabatkins
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/2568#issuecomment-381703388 using your GitHub account

Received on Monday, 16 April 2018 18:28:05 UTC