I would like to write jQuery statements like:
$(".someparentcontainer input[type=checkbox]:is(.foo, .bar, .xyz)")
As a shorthand for:
$(".someparentcontainer input[type=checkbox].foo, .someparentcontainer input[type=checkbox].bar, .someparentcontainer input[type=checkbox].xyz)")
Since jQuery doesn't support (to my knowledge) an :is() selector I came up with the following workaround:
$(".someparentcontainer input[type=checkbox]:not(:not(.foo, .bar, .xyz))")
I do realize that it has its drawbacks in terms of performance if .someparentcontainer has a ton of child elements, but it works pretty well for small dom-trees.
Are there any pitfalls I might be missing here? Any scenarios where this technique might fail?