Repository navigation
Add has() selector helper - #5518
Conversation
|
Tested. Almost every replacement I made was incorrect:
I'll merge this PR to enable more usage in the future. Also ideally we'd add |
| function init(): void { | ||
| const actionRepo = select('aside .octicon-repo')! | ||
| .closest('a')! | ||
| const actionRepo = selectHas('a:has(aside .octicon-repo)')! |
There was a problem hiding this comment.
These selectors are real, valid selectors and can be tested natively in Safari. In the future we'll be able to just replace selectHas with select
There was a problem hiding this comment.
I'm tempted to #enable-experimental-web-platform-features now
Or maybe install Chrome Dev which just added :has() support in 105. But it is scheduled to release on Aug 30 according to Chromium Dash, so I'll just wait for two months 😆
There was a problem hiding this comment.
Firefox will delay this a while longer. No work in progress at all. https://bugzilla.mozilla.org/show_bug.cgi?id=418039
I think we can’t try the native implementation until we’re ready to ship or else we need to test each selector for both native and polyfilled version. The polyfill is very limited
|
Looking forward to seeing more uses in our features! |
select().closest()calls with:has#44564 fun
It can be used to replace:
but not:
existingElement.closest('parent')Since this isn't native, it can't be used:
as well as:
deep-reblameanddim-botsfor exampleSide note:
select + closestit usesselect.all + select multipletimes😅 but how bad can it be? Maybe I can fix this though