Commit d585dbd4 authored by Ian Jones's avatar Ian Jones

guard clause earlier

parent b11ba67e
...@@ -120,6 +120,10 @@ function findDOMNode( ...@@ -120,6 +120,10 @@ function findDOMNode(
* Check if a HTMLElement is hidden or fixed/sticky position * Check if a HTMLElement is hidden or fixed/sticky position
*/ */
function shouldSkipElement(element: HTMLElement) { function shouldSkipElement(element: HTMLElement) {
if (element.tagName === 'HTML' || element.tagName === 'BODY') {
return false
}
// we ignore fixed or sticky positioned elements since they'll likely pass the "in-viewport" check // we ignore fixed or sticky positioned elements since they'll likely pass the "in-viewport" check
// and will result in a situation we bail on scroll because of something like a fixed nav, // and will result in a situation we bail on scroll because of something like a fixed nav,
// even though the actual page content is offscreen // even though the actual page content is offscreen
...@@ -133,11 +137,7 @@ function shouldSkipElement(element: HTMLElement) { ...@@ -133,11 +137,7 @@ function shouldSkipElement(element: HTMLElement) {
return true return true
} }
return ( return element.offsetParent === null
element.offsetParent === null &&
element.tagName !== 'HTML' &&
element.tagName !== 'BODY'
)
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment