isVisible.js 490 B

1234567891011121314151617
  1. import { getWindow } from './getWindow.js';
  2. function isVisible(element) {
  3. const window = getWindow(element);
  4. for(let el = element; el === null || el === undefined ? undefined : el.ownerDocument; el = el.parentElement){
  5. const { display, visibility } = window.getComputedStyle(el);
  6. if (display === 'none') {
  7. return false;
  8. }
  9. if (visibility === 'hidden') {
  10. return false;
  11. }
  12. }
  13. return true;
  14. }
  15. export { isVisible };