Automatic update from web-platform-tests WebKit export of https://bugs.webkit.org/show_bug.cgi?id=314778 -- wpt-commits: 1e98f48e81b20e7bf91fcdf6e0a8319558bd6254 wpt-pr: 60041
47 lines
1.1 KiB
HTML
47 lines
1.1 KiB
HTML
<!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>
|