Closed dvoytenko closed 4 years ago
Thanks for filing this PR. These changes look pretty reasonable on first look (with a few nits). Have you looked into added a test for this new behavior?
Definitely. I added several tests in the describe('same-origin iframe')
. I added tests, for three categories of things:
Ahh, sorry, the GitHub UI was hiding the diff for that file, so I missed it. Will take a look later today.
@philipwalton I fixed the tests and tested with IE11 and IE10. PTAL.
Close/reopen to run CI again.
The polyfill is updated to support observing targets in the same-origin iframes. This is already a spec'd behavior and only polyfill abilities are enhanced. See https://www.w3.org/TR/intersection-observer/#dom-intersectionobserver-rootmargin for more info.
Notably, the changes to do not polyfill the
IntersectionObserver
inside an iframe, but simply allow observing using the top-level contextIntersectionObserver
. The final interface binding can be done by manually:In practice, however, I find that even when same-origin iframes are used, the root observer is used for them. The tests show this pattern.