Home > widget-integration > FilterController > isBackgroundImageEmpty
FilterController.isBackgroundImageEmpty() method
Checks if an element has an empty background image. Verifies both inline and computed background image styles.
Signature:
protected isBackgroundImageEmpty(label: HTMLElement): boolean;
Parameters
|
Parameter |
Type |
Description |
|---|---|---|
|
label |
HTMLElement |
The element to check |
Returns:
boolean
True if background image is empty or 'none', false otherwise
Remarks
This method checks both inline styles and computed styles to determine if a background image is truly absent. Used to determine if custom images should be applied to swatch elements.
Example
Override to add additional checks:
window.boostWidgetIntegration.extend('FilterController', (FilterController) => {
return class CustomFilterController extends FilterController {
protected isBackgroundImageEmpty(label) {
// Also check for data attributes indicating image state
if (label.dataset.hasCustomImage === 'true') {
return false;
}
return super.isBackgroundImageEmpty(label);
}
};
});