Skip to content

Commit

Permalink
fix: detect document using nodeType, fixes #11
Browse files Browse the repository at this point in the history
  • Loading branch information
theKashey committed Oct 17, 2019
1 parent 04102e4 commit c03e6bc
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/utils/DOMutils.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ const isElementHidden = (computedStyle) => {
};

export const isVisible = node => (
(!node || node === document) ||
(
!node ||
node === document ||
node.nodeType === Node.DOCUMENT_NODE
) ||
(
!isElementHidden(window.getComputedStyle(node, null)) &&
isVisible(node.parentNode)
Expand Down

0 comments on commit c03e6bc

Please sign in to comment.