Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function visible(fnode) {
const element = fnode.element;
for (const ancestor of ancestors(element)) {
const style = getComputedStyle(ancestor);
if (style.getPropertyValue('visibility') === 'hidden' ||
style.getPropertyValue('display') === 'none') {
return 0;
}
// Could add opacity and size checks here, but the
// "nearlyOpaque" and "big" rules already deal with opacity
// and size. If they don't do their jobs, maybe repeat
// their work here (so it gets a different coefficient).
}
return 1;
}