mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
fix: remove boundary conditions for visibility (#9249)
Fixed: https://github.com/puppeteer/puppeteer/issues/9232
This commit is contained in:
parent
86abe68849
commit
e003513c0c
@ -58,11 +58,11 @@ export const checkVisibility = (
|
||||
const isVisible =
|
||||
style &&
|
||||
!HIDDEN_VISIBILITY_VALUES.includes(style.visibility) &&
|
||||
isBoundingBoxVisible(element);
|
||||
!isBoundingBoxEmpty(element);
|
||||
return visible === isVisible ? node : false;
|
||||
};
|
||||
|
||||
function isBoundingBoxVisible(element: Element): boolean {
|
||||
function isBoundingBoxEmpty(element: Element): boolean {
|
||||
const rect = element.getBoundingClientRect();
|
||||
return rect.width > 0 && rect.height > 0 && rect.right > 0 && rect.bottom > 0;
|
||||
return rect.width === 0 || rect.height === 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user