Skip to content

Commit

Permalink
* core: add checkZeroSize option to isVisible helper.
Browse files Browse the repository at this point in the history
  • Loading branch information
catouse committed Jun 18, 2024
1 parent da183e7 commit e0df9a5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/core/src/dom/is-visible.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ type ISVisibleOptions = {
fullyCheck?: boolean;
viewport?: {left: number, top: number, width: number, height: number} | DOMRectReadOnly;
container?: Comparator;
checkZeroSize?: boolean;
};

/**
Expand All @@ -26,7 +27,7 @@ export function isVisible(selector: Selector, options: ISVisibleOptions = {}): b

let {viewport} = options;
const {left, top, width, height} = element.getBoundingClientRect();
if (!(width * height)) {
if (options.checkZeroSize && !(width * height)) {
return false;
}
if (!viewport) {
Expand Down

0 comments on commit e0df9a5

Please sign in to comment.