w3c / IntersectionObserver

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

Fix same-origin polyfill to work the same way when loaded from iframe as from mainframe #436

Closed dvoytenko closed 4 years ago

dvoytenko commented 4 years ago

It shouldn't matter whether from the same-origin iframe point of view whether the polyfill was loaded in the mainframe or subframe: they should work the same in terms of rootBounds and all other logic.

E.g. the following snippets should work similar from the point of view of most of Intersection Observer API when observing the element <div id=one>:

<script src=".../polyfill.js"></script>
<iframe srcdoc="<div id=one></div>"></iframe>
<iframe srcdoc="<script src=".../polyfill.js"></script><div id=one></div>"></iframe>