summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/img-empty-alt-replaced.html
blob: 3cc06d6c8538a4b1431c1de9d46ac4a1c706dbec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<!doctype html>
<title>Images with an empty alt attribute have an intrinsic size of zero</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
  img {
    width: 50px;
    height: auto;
  }
</style>
<img src="broken">
<img src="broken" alt="non-empty">
<img src="broken" alt="">
<script>
const t = async_test("Images with an empty alt attribute have an intrinsic size of zero");
onload = t.step_func_done(function() {
  for (const img of document.querySelectorAll("img")) {
    const alt = img.getAttribute("alt");
    const shouldTakeUpSpace = alt == null || alt.length > 0;
    (shouldTakeUpSpace ? assert_not_equals : assert_equals)(img.offsetHeight, 0, img.outerHTML);
  }
});
</script>