This is usually zero or larger. But the zero value is still valid and means at least 1 pixel is 'intersecting'. I've seen repeated code test just the intersectionRatio, 'intersectionRatio > 0'. This can cause some issues when scrolling because if it is zero then the test would miss the movement of the target element inside the root. I usually change the test to >= 0. I also test the isIntersecting property. I think people are using this shortcut for 'has this element moved inside the area I want to observe'. IntersectionRatio can never be less than zero? Maybe it should?
This is usually zero or larger. But the zero value is still valid and means at least 1 pixel is 'intersecting'. I've seen repeated code test just the intersectionRatio, 'intersectionRatio > 0'. This can cause some issues when scrolling because if it is zero then the test would miss the movement of the target element inside the root. I usually change the test to >= 0. I also test the isIntersecting property. I think people are using this shortcut for 'has this element moved inside the area I want to observe'. IntersectionRatio can never be less than zero? Maybe it should?