Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

<!DOCTYPE html>
<meta charset="utf-8">
<title>Image fallback baseline alignment</title>
<link rel="author" href="mailto:zhoupeng.1996@bytedance.com">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
div {
background: red;
line-height: 200px;
width: 100px;
}
img {
border-right: solid 30px black;
width: 30px;
height: 30px;
}
</style>
<body>
<div>
<img src="">
</div>
<script>
async_test(t => {
const img = document.querySelector('img');
const div = document.querySelector('div');
img.src = '';
img.onerror = t.step_func_done(() => {
assert_greater_than(img.offsetTop, div.offsetTop);
assert_less_than(img.offsetTop + img.offsetHeight, div.offsetTop + div.offsetHeight);
});
});
</script>
</body>