mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
Update web-platform-tests to revision 1268bd5901289acc95b1a576f108bdf382d82e44
This commit is contained in:
parent
f183d66217
commit
292a12e545
261 changed files with 5513 additions and 966 deletions
|
@ -0,0 +1,55 @@
|
|||
<!DOCTYPE html>
|
||||
<head>
|
||||
<title>In-viewport loading=lazy images do not block the window load event</title>
|
||||
<link rel="author" title="Rob Buis" href="mailto:rbuis@igalia.com">
|
||||
<link rel="author" title="Dom Farolino" href="mailto:dom@chromium.org">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="common.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<!-- This image blocks the window load event for 1 second -->
|
||||
<img src="resources/image.png?window-load-blocking&pipe=trickle(d1)">
|
||||
|
||||
<!-- These images must load because they intersect the viewport, but they must
|
||||
not block the window load event, because they are loading=lazy -->
|
||||
<img id="visible"
|
||||
src="resources/image.png?visible&pipe=trickle(d3)" loading="lazy"
|
||||
onload="visible_img.resolve();" onerror="visible_img.reject();">
|
||||
<img id="visibility_hidden" style="visibility:hidden;"
|
||||
src="resources/image.png?visibility_hidden&pipe=trickle(d3)" loading="lazy"
|
||||
onload="visibility_hidden_img.resolve();" onerror="visibility_hidden_img.reject();">
|
||||
</body>
|
||||
|
||||
<!--
|
||||
Marked as tentative until https://github.com/whatwg/html/pull/3752 is landed.
|
||||
-->
|
||||
|
||||
<script>
|
||||
const visible_img = new ElementLoadPromise("visible");
|
||||
const visibility_hidden_img = new ElementLoadPromise("visibility_hidden");
|
||||
|
||||
async_test(t => {
|
||||
|
||||
let has_window_loaded = false;
|
||||
window.addEventListener("load", t.step_func(() => {
|
||||
has_window_loaded = true;
|
||||
}));
|
||||
|
||||
Promise.all([visible_img.promise, visibility_hidden_img.promise])
|
||||
.then(t.step_func_done(() => {
|
||||
assert_true(has_window_loaded,
|
||||
"The window load event should fire before the " +
|
||||
"in-viewport loading=lazy images load");
|
||||
assert_true(visible_img.element().complete,
|
||||
"The in-viewport loading=lazy visible image is complete");
|
||||
assert_true(visibility_hidden_img.element().complete,
|
||||
"The in-viewport loading=lazy visibility:hidden image is " +
|
||||
"complete");
|
||||
}))
|
||||
.catch(t.unreached_func("The images should load successfully"));
|
||||
|
||||
}, "In-viewport loading=lazy images do not block the window load event");
|
||||
</script>
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue