DOM Observer API
spy.has()
asyncValidates whether the components identified by the passed names are actively observing, or whether the matched DOM elements are being observed.
- Accepts arguments as strings and arrays of strings.
You can pass component names as individual arguments, as an array, or as a string separated by commas or spaces.
Each value is seen as a new argument. - Returns true if all components identified by the passed names are actively observing or if all the matched DOM elements are being observed, otherwise, returns false.
Example:
await spy.has('component_1');
// true
await spy.has('component_3');
// false
await spy.has('component_1', 'component_2');
await spy.has(['component_1', 'component_2']);
await spy.has('component_1, component_2');
await spy.has('component_1 component_2');
// true
await spy.has('component_1', 'component_3');
// false
await $('div').spy.has();
// true
await $('div ?').spy.has();
// true
await $('span').spy.has();
// false
await $('div, span ?').spy.has();
// false