-
Notifications
You must be signed in to change notification settings - Fork 515
Description
IntersectionObserver/polyfill/intersection-observer.js
Lines 334 to 350 in b38e62b
| if (!oldEntry) { | |
| this._queuedEntries.push(newEntry); | |
| } else if (rootIsInDom && rootContainsTarget) { | |
| // If the new entry intersection ratio has crossed any of the | |
| // thresholds, add a new entry. | |
| if (this._hasCrossedThreshold(oldEntry, newEntry)) { | |
| this._queuedEntries.push(newEntry); | |
| } | |
| } else { | |
| // If the root is not in the DOM or target is not contained within | |
| // root but the previous entry for this target had an intersection, | |
| // add a new record indicating removal. | |
| if (oldEntry && oldEntry.isIntersecting) { | |
| this._queuedEntries.push(newEntry); | |
| } | |
| } | |
| }, this); |
@philipwalton Hi, Phillip! As I've found during my development process. When an entry is moved in or out of root element, the code doesn't run _hasCrossedThreshold . Is this behavior expected?
The MDN docs doesn't specify the behavior on show/hide, it just says when crossing the threshold the callback should be triggered. https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API#Intersection_change_callbacks
I tested on my Chrome 73 OSX, show/hide respects threshold value. However the native implementation of an android 4.4.4 native browser at hand behave just like your code does.
If this is the wrong behavior, I'd like to submit a pull request. And please let me know if this is intended.