- From: Tab Atkins Jr. via GitHub <sysbot+gh@w3.org>
- Date: Mon, 16 Apr 2018 18:32:40 +0000
- To: public-css-archive@w3.org
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