Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

<!DOCTYPE html>
<title>Intersection Observer: root margin is applied when observer is in a same-origin iframe</title>
<link rel="author" title="Kiet Ho" href="mailto:kiet.ho@apple.com">
<script src="/common/rendering-utils.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
#iframe {
width: 40px;
height: 40px;
display: block;
position: fixed;
left: 0;
top: -40px;
border: 0;
}
</style>
<iframe id="iframe"></iframe>
<script>
isIntersecting = null;
window.addEventListener("message", event => {
isIntersecting = event.data.isIntersecting;
});
function loadFrame() {
return new Promise(resolve => {
iframe.addEventListener("load", resolve, { once: true });
iframe.src = "resources/root-margin-in-same-origin-iframe-subframe.html";
});
}
promise_test(async (t) => {
await loadFrame();
await waitForAtLeastOneFrame();
await waitForAtLeastOneFrame();
await waitForAtLeastOneFrame();
assert_true(isIntersecting);
});
</script>