dperini / nwsapi

Fast CSS Selectors API Engine
MIT License
103 stars 35 forks source link

Missing support for :has() pseudo-class #72

Closed KittyGiraudel closed 1 year ago

KittyGiraudel commented 1 year ago

Support for the :has() pseudo-class is getting very good with only Firefox lacking support for wide adoption.

As far as I can tell from the wiki, it seems like nwsapi does not support :has() yet? In turns, this makes JSDOM throwing errors when using a selector containing the :has() pseudo-class — which is not ideal.

I think the implementation should be relatively similar to the :is() and :not() pseudo-classes? Judging by the spec, that is. What’s nice (I think?) about this pseudo-class is that it accepts a <forgiving-relative-selector-list> which means the validation of the argument doesn’t have to be strict.

bramus commented 1 year ago

Correction: :has() does not accept a <forgiving-relative-selector-list>. It was initially specced that way but this is no longer the case as per CSS WG Resolution

See the latest editors draft of the spec for an updated definition.

KittyGiraudel commented 1 year ago

Ah, right. I forgot about this. Thank you Bramus. :)

LyzioOh commented 1 year ago

Hi, are PR welcome ?

dperini commented 1 year ago

@LyzioOh Yes they are much appreciated. If related to bugs remember to include a small reproducible code showing how/when the bug happen. In case of requests for new functionalities they will be discussed with jsdom maintainers. For the remaining cases CSS Selector Level 4 is the target reference spec.

dperini commented 1 year ago

@KittyGiraudel there are still no plans to implement the :has() pseudo-class so I am closing this issue for now.