dperini / nwsapi

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

unknown pseudo-class selector ':defined' #77

Closed CITguy closed 1 year ago

CITguy commented 1 year ago

Basic Info:

Additional Info

Per MDN and WHATWG, the :defined pseudo-selector should be a valid selector.

I want to use this selector within jest unit tests to check that a custom element has been defined.

dperini commented 1 year ago

@CITguy I will consider this pseudo-class addition in a future release. In the meantime you can load a duplicate instance of "nwsapi" and extend it to cover your needs by using something like the following:

NW.Dom.registerSelector(
  'elementDefined',
   /^\:defined/i,
  (function(global) {
    ...
    // see details in src/module/nwsapi-jquery.js
    ...
  })(this));