-
Notifications
You must be signed in to change notification settings - Fork 520
Description
So the spec says that technically, you're supposed to set isIntersecting
to true
unconditionally, regardless of threshold:
https://w3c.github.io/IntersectionObserver/#update-intersection-observations-algo:
Let isIntersecting be true if targetRect and rootBounds intersect or are edge-adjacent, even if the intersection has zero area (because rootBounds or targetRect have zero area); otherwise, let isIntersecting be false.
It also says that we should schedule notifications whenever isIntersecting
changes, regardless of the threshold change. However that doesn't match browsers, see:
- https://bugs.webkit.org/show_bug.cgi?id=212303
- https://bugs.chromium.org/p/chromium/issues/detail?id=1085938
- https://bugzilla.mozilla.org/show_bug.cgi?id=1611204
Firefox initially implemented the spec to the letter but had a workaround of sorts to make it similar to other browsers:
- https://searchfox.org/mozilla-central/rev/501eb4718d73870892d28f31a99b46f4783efaa0/dom/base/DOMIntersectionObserver.cpp#624-633
- https://bugzilla.mozilla.org/show_bug.cgi?id=1391154
Given no browser follows the spec, and that Firefox is pretty close to other browsers, except on the specific value of isIntersecting
, I think we should change the spec and Firefox, probably... But it seems kind of an unfortunate situation to be in.