W3C home > Mailing lists > Public > public-css-archive@w3.org > August 2019

Re: [csswg-drafts] [selectors-4] Rescope :has to static CSS rather than .querySelector (#3925)

From: ExE Boss via GitHub <sysbot+gh@w3.org>
Date: Thu, 08 Aug 2019 04:49:41 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-519362052-1565239779-sysbot+gh@w3.org>
@SelenIT
The following is more performant:
```js
Array.from(document.querySelectorAll('a img', img => {
	let el = img;
	while ((el = el.parentElement)) {
		if (el.localName.toLowerCase() == 'a') return el;
	}
	return null;
});
```

-- 
GitHub Notification of comment by ExE-Boss
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/3925#issuecomment-519362052 using your GitHub account
Received on Thursday, 8 August 2019 04:49:42 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 19 October 2021 01:31:12 UTC