You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The :has() CSS selector is nowhere to be seen yet and given the recent de-class-ification of GitHub’s DOM we found ourself needing code like this very often:
select('.some-octicon').closest('details')
"Custom API" suggestion, discarded. Sizzle is best
so I wonder how we can "polyfill" the selector without have to load Sizzle. Example:
Activity
fregante commentedon Jun 10, 2021
Or maybe, instead of awkward APIs, we could just load up Sizzle, 20KB
[-]Replace `select().closest()` calls with custom `select` API[/-][+]Replace `select().closest()` calls `sizzle`[/+]fregante commentedon Aug 18, 2021
The advantage of just using
sizzleis that we can drop it easily once:has()becomes available in every browser (2028)[-]Replace `select().closest()` calls `sizzle`[/-][+]Replace `select().closest()` calls with `sizzle`[/+]kidonng commentedon Oct 11, 2021
This will also save some
textContent.includeswe have, using:contains(not that urgent though).fregante commentedon Oct 11, 2021
That'd be nice, but then we won't be able to drop the dependency.
I think it's still worth it for now though since… we'll probably have the dependency for a while anyway.
fregante commentedon Mar 15, 2022
5% of our users have it. 95% more to go.
[-]Replace `select().closest()` calls with `sizzle`[/-][+]Replace `select().closest()` calls with `:has`[/+]