Automatic update from web-platform-tests
WebKit export of https://bugs.webkit.org/show_bug.cgi?id=240083 (#33971)

Use correct document as root for lazy image observer
--

wpt-commits: 8c4c2635c4816e02071ed7e594c71cb52a09f19d
wpt-pr: 33971
This commit is contained in:
Rob Buis 2022-05-08 17:52:33 +00:00 коммит произвёл moz-wptsync-bot
Родитель acb50ec514
Коммит 788f7cd9ae
1 изменённых файлов: 32 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,32 @@
<!DOCTYPE html>
<title>Scrolling a lazy loaded image into view in an iframe</title>
<script src='/resources/testharness.js'></script>
<script src='/resources/testharnessreport.js'></script>
<iframe onload="async_test(this.contentWindow.run)" srcdoc="
<!DOCTYPE html>
<script src='/resources/testharness.js'></script>
<script src='/resources/testharnessreport.js'></script>
<script src='../resources/common.js'></script>
<h1>Scroll down...</h1>
<p>Scroll down...</p>
<p>Scroll down...</p>
<img id='below_iframe_viewport_img' src='resources/image.png' loading='lazy'
onload='below_iframe_viewport_img.resolve();' onerror='below_iframe_viewport_img.reject();'>
<script>
const scroll_trigger_img = new ElementLoadPromise('visible');
const below_iframe_viewport_img = new ElementLoadPromise('below_iframe_viewport_img');
function run(t) {
below_iframe_viewport_img.element().scrollIntoView();
below_iframe_viewport_img.promise
.then(t.step_func(() => {
assert_not_equals(below_iframe_viewport_img.element().width, 0, 'width should be greater than zero after scrolling');
assert_not_equals(below_iframe_viewport_img.element().height, 0, 'height should be greater than zero after scrolling');
t.done();
}))
.catch(t.unreached_func('The below_iframe_viewport image should load'));
};
</script>
"></iframe>