Kevin Powell - CommunityKP-C
Kevin Powell - Community2y ago
27 replies
LcsGa

Shorten / improve CSS selector

Hi guys, I am wondering if there is a way to shorten that selector (used in a querySelector): :is(.ng-invalid, .ng-invalid:not(form) *):is(input, textarea)?

What I want in the end is to select either input.ng-invalid or textarea.ng-invalid or .ng-invalid:not(form) input or .ng-invalid:not(form) textarea but I can't find a good way.
I tried something like .ng-invalid:not(form):is(*, * *):is(input, textarea) where I hopped for :is(*, * *) to sort of "replace" the first * with .ng-invalid:not(form) but of course it's not working!
Was this page helpful?