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

For example:

```
function firstMatch(el, pred) {
  if(pred(el)) return el;
  for(const child of el.childElements) {
    const result = firstMatch(child);
    if(result) return result;
  }
}

const firstPOnPage = firstMatch(document.body, x=>x.matches("p"));
```

would find the first `p` element on the page.

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

Received on Monday, 16 April 2018 18:32:43 UTC