w3c / IntersectionObserver

Intersection Observer
https://www.w3.org/TR/intersection-observer/
Other
3.62k stars 526 forks source link

Support iframe viewport tracking #465

Closed samouri closed 3 years ago

samouri commented 3 years ago

summary Implements iframe viewport tracking for the polyfill, as described in https://github.com/w3c/IntersectionObserver/issues/372#issuecomment-575287674.

The following tasks have been completed:

Implementation already completed:

cc @dvoytenko

samouri commented 3 years ago

open question: do we want to do feature detection for iframe viewport tracking and replace native with the polyfill if support is missing?

I'm leaning towards no and allowing consumers to detect it themselves. If they prefer the polyfill they can run delete InOb from window before running the polyfill.

dvoytenko commented 3 years ago

I think this is really close now.

samouri commented 3 years ago

Darn. I believe I found a webkit bug.

Essentially, Chrome and FF ensure that rootBounds when root:document are relative to the specified document (top is always 0). Safari gives the top based on current scroll position within the iframe.

See: https://output.jsbin.com/jutegazuxe

samouri commented 3 years ago

Current status:


@dvoytenko: PTAL

dvoytenko commented 3 years ago
  • Chrome: A different newly introduced test fails. Chrome is allowing for cross-document tracking which is explicitly against spec right now.

Can we link the crbug issue here as well?